NetBSD-Bugs archive

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

kern/49636: Return 0L in sosend_loan



>Number:         49636
>Category:       kern
>Synopsis:       Return 0L in sosend_loan
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Feb 03 14:10:00 +0000 2015
>Originator:     Henning Petersen
>Release:        NetBSD-current
>Organization:
>Environment:
>Description:
return 0L in sosend_loan and compare sosend_loan with 0L.
>How-To-Repeat:

>Fix:
diff -u -p -r1.235 uipc_socket.c
--- sys/kern/uipc_socket.c	5 Sep 2014 09:20:59 -0000	1.235
+++ sys/kern/uipc_socket.c	3 Feb 2015 12:20:04 -0000
@@ -343,7 +343,7 @@ sosend_loan(struct socket *so, struct ui
 	int i;
 
 	if (VMSPACE_IS_KERNEL_P(uio->uio_vmspace))
-		return (0);
+		return 0L;
 
 	if (iov->iov_len < (size_t) space)
 		space = iov->iov_len;
@@ -359,13 +359,13 @@ sosend_loan(struct socket *so, struct ui
 
 	lva = sokvaalloc(sva, len, so);
 	if (lva == 0)
-		return 0;
+		return 0L;
 
 	error = uvm_loan(&uio->uio_vmspace->vm_map, sva, len,
 	    m->m_ext.ext_pgs, UVM_LOAN_TOPAGE);
 	if (error) {
 		sokvafree(lva, len);
-		return (0);
+		return 0L;
 	}
 
 	for (i = 0, va = lva; i < npgs; i++, va += PAGE_SIZE)
@@ -991,7 +991,7 @@ sosend(struct socket *so, struct mbuf *a
 				    uio->uio_iov->iov_len >= sock_loan_thresh &&
 				    space >= sock_loan_thresh &&
 				    (len = sosend_loan(so, uio, m,
-						       space)) != 0) {
+						       space)) != 0L) {
 					SOSEND_COUNTER_INCR(&sosend_loan_big);
 					space -= len;
 					goto have_data;
@@ -1157,7 +1157,7 @@ soreceive(struct socket *so, struct mbuf
 	if (controlp != NULL)
 		*controlp = NULL;
 	if (flagsp != NULL)
-		flags = *flagsp &~ MSG_EOR;
+		flags = *flagsp & ~MSG_EOR;
 	else
 		flags = 0;
 



Home | Main Index | Thread Index | Old Index