Might be an idea to add a comment in a good place pointing out that that should not be unsigned
so that the next person doesn't make the same mistake..


On 1/3/17 12:24 pm, Alexander Motin wrote:
Author: mav
Date: Wed Mar  1 04:24:30 2017
New Revision: 314465
URL: https://svnweb.freebsd.org/changeset/base/314465

Log:
   MFC r313779: Fix handling of negative sbspace() return values.
I found that at least with Chelsio NICs TOE sockets quite often report
   negative sbspace() values.  Using unsigned variable to store it resulted
   in attempts to aggregate too much data in one sosend() call, that caused
   errors and following connection termination.

Modified:
   stable/11/sys/dev/iscsi/icl_soft.c
Directory Properties:
   stable/11/   (props changed)

Modified: stable/11/sys/dev/iscsi/icl_soft.c
==============================================================================
--- stable/11/sys/dev/iscsi/icl_soft.c  Wed Mar  1 04:24:24 2017        
(r314464)
+++ stable/11/sys/dev/iscsi/icl_soft.c  Wed Mar  1 04:24:30 2017        
(r314465)
@@ -892,7 +892,7 @@ icl_conn_send_pdus(struct icl_conn *ic,
  {
        struct icl_pdu *request, *request2;
        struct socket *so;
-       size_t available, size, size2;
+       long available, size, size2;
        int coalesced, error;
ICL_CONN_LOCK_ASSERT_NOT(ic);
@@ -931,7 +931,7 @@ icl_conn_send_pdus(struct icl_conn *ic,
                        if (available < size) {
  #if 1
                                ICL_DEBUG("no space to send; "
-                                   "have %zd, need %zd",
+                                   "have %ld, need %ld",
                                    available, size);
  #endif
                                so->so_snd.sb_lowat = size;
@@ -978,7 +978,7 @@ icl_conn_send_pdus(struct icl_conn *ic,
                        }
  #if 0
                        if (coalesced > 1) {
-                               ICL_DEBUG("coalesced %d PDUs into %zd bytes",
+                               ICL_DEBUG("coalesced %d PDUs into %ld bytes",
                                    coalesced, size);
                        }
  #endif



_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to