tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

soreserve() return value



Hi:

It looks like the return value from soreserve()
should be checked as per the attached diff.  Any
concerns?

Regards,

-seanb
Index: sys/kern/uipc_socket2.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_socket2.c,v
retrieving revision 1.102
diff -u -r1.102 uipc_socket2.c
--- sys/kern/uipc_socket2.c     9 Apr 2009 00:43:38 -0000       1.102
+++ sys/kern/uipc_socket2.c     23 Jul 2009 14:05:13 -0000
@@ -279,7 +279,10 @@
        so->so_rcv.sb_mowner = head->so_rcv.sb_mowner;
        so->so_snd.sb_mowner = head->so_snd.sb_mowner;
 #endif
-       (void) soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat);
+       if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat) != 0) {
+               soput(so);
+               return NULL;
+       }
        so->so_snd.sb_lowat = head->so_snd.sb_lowat;
        so->so_rcv.sb_lowat = head->so_rcv.sb_lowat;
        so->so_rcv.sb_timeo = head->so_rcv.sb_timeo;


Home | Main Index | Thread Index | Old Index