>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 
[email protected]:/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:
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to