Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Jul 2010 18:31:46 +0200 (CEST)
From:      Thomas Quinot <thomas@cuivre.fr.eu.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/149117: in_pcbbind: redundant test
Message-ID:  <20100730163146.6F323261C@melamine.cuivre.fr.eu.org>
Resent-Message-ID: <201007301640.o6UGe7uh059672@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         149117
>Category:       kern
>Synopsis:       in_pcbbind: redundant test
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 30 16:40:06 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Thomas Quinot
>Release:        FreeBSD 8.0-STABLE amd64
>Organization:
>Environment:
System: FreeBSD melamine.cuivre.fr.eu.org 8.0-STABLE FreeBSD 8.0-STABLE #0: Sun Mar 28 14:46:11 CEST 2010 thomas@melamine.cuivre.fr.eu.org:/usr/obj/usr/src/sys/GENERIC amd64


	
>Description:
	in_pcbbind has a redundant test for inp->inp_lport == 0:
	if this is not true, the if statement just above will have
	caused an early return with EINVAL.

>How-To-Repeat:
	Found by code reading. No observable effect.
>Fix:

Index: in_pcb.c
===================================================================
--- in_pcb.c	(révision 210660)
+++ in_pcb.c	(copie de travail)
@@ -296,8 +296,7 @@
 
 	if (inp->inp_lport != 0 || inp->inp_laddr.s_addr != INADDR_ANY)
 		return (EINVAL);
-	anonport = inp->inp_lport == 0 && (nam == NULL ||
-	    ((struct sockaddr_in *)nam)->sin_port == 0);
+	anonport = nam == NULL || ((struct sockaddr_in *)nam)->sin_port == 0;
 	error = in_pcbbind_setup(inp, nam, &inp->inp_laddr.s_addr,
 	    &inp->inp_lport, cred);
 	if (error)


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100730163146.6F323261C>