NetBSD-Bugs archive

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

Re: kern/49636: Return 0L in sosend_loan



The following reply was made to PR kern/49636; it has been noted by GNATS.

From: Valery Ushakov <uwe%stderr.spb.ru@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: henning.petersen%t-online.de@localhost
Subject: Re: kern/49636: Return 0L in sosend_loan
Date: Mon, 10 Oct 2016 13:41:27 +0300

 > >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;
 
 Please, can you explain what this change fixes?  Why integer promotion
 rules are not enough here?
 
 There are probeblay hundreds of "0" in our tree that are used to
 signify "0L", "0U", etc.  Why "fix" these specific instances?
 
 Why this patch changes:
 
     len != 0L
 
 but leaves alone
 
     resid < 0
 
 with unmarked "0" a bit earlier in the same function.
 
 I strongly object to introducing unnecessary casts/suffixes.  They
 signal that normal promotion doesn't work here for one reason or other
 and introduce perceptional burden on the reader.  Unless there's such
 reason, I'd rather see that change reverted.
 
 -uwe
 


Home | Main Index | Thread Index | Old Index