NetBSD Problem Report #49636
From www@NetBSD.org Tue Feb 3 14:07:23 2015
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id 2AD53A650D
for <gnats-bugs@gnats.NetBSD.org>; Tue, 3 Feb 2015 14:07:23 +0000 (UTC)
Message-Id: <20150203140721.EB8B2A65B0@mollari.NetBSD.org>
Date: Tue, 3 Feb 2015 14:07:21 +0000 (UTC)
From: henning.petersen@t-online.de
Reply-To: henning.petersen@t-online.de
To: gnats-bugs@NetBSD.org
Subject: Return 0L in sosend_loan
X-Send-Pr-Version: www-1.0
>Number: 49636
>Category: kern
>Synopsis: Return 0L in sosend_loan
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Feb 03 14:10:00 +0000 2015
>Closed-Date: Fri Oct 14 00:42:27 +0000 2016
>Last-Modified: Fri Oct 14 00:42:27 +0000 2016
>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;
>Release-Note:
>Audit-Trail:
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49636 CVS commit: src/sys/kern
Date: Mon, 10 Oct 2016 01:22:08 +0000
Module Name: src
Committed By: dholland
Date: Mon Oct 10 01:22:08 UTC 2016
Modified Files:
src/sys/kern: uipc_socket.c
Log Message:
PR 49636 Henning Petersen: use "0L" to return 0 from a function returning
long, and test its returned value against "0L" instead of "0".
This is not especially necessary, but it's also harmless.
To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/sys/kern/uipc_socket.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49636 CVS commit: src/sys/kern
Date: Mon, 10 Oct 2016 01:22:51 +0000
Module Name: src
Committed By: dholland
Date: Mon Oct 10 01:22:51 UTC 2016
Modified Files:
src/sys/kern: uipc_socket.c
Log Message:
foo & ~bar, not foo &~ bar. From Henning Petersen in PR 49636.
To generate a diff of this commit:
cvs rdiff -u -r1.250 -r1.251 src/sys/kern/uipc_socket.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 10 Oct 2016 01:26:23 +0000
State-Changed-Why:
fixed, thanks
From: Valery Ushakov <uwe@stderr.spb.ru>
To: gnats-bugs@NetBSD.org
Cc: henning.petersen@t-online.de
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
From: "Valeriy E. Ushakov" <uwe@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/49636 CVS commit: src/sys/kern
Date: Thu, 13 Oct 2016 19:10:23 +0000
Module Name: src
Committed By: uwe
Date: Thu Oct 13 19:10:23 UTC 2016
Modified Files:
src/sys/kern: uipc_socket.c
Log Message:
Revert to revision 1.249 to undo changes from PR 49636.
Marking up some zeroes with a type suffix, while not marking others in
the very same function does nothing but places cognitive burden on the
reader.
Spelling "clear bits" as "&~" is actually not uncommon (and some say
is more readable).
To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/sys/kern/uipc_socket.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: closed->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 14 Oct 2016 00:42:11 +0000
State-Changed-Why:
Reverted.
State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Fri, 14 Oct 2016 00:42:27 +0000
State-Changed-Why:
aaaand, wontfix. I guess.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.