kern/81371: [PATCH] ng_socket: 2nd "int error" hides real error code

Wojciech A. Koszek dunstan at freebsd.czest.pl
Sun May 22 20:40:07 GMT 2005


>Number:         81371
>Category:       kern
>Synopsis:       [PATCH] ng_socket: 2nd "int error" hides real error code
>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:   Sun May 22 20:40:06 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Wojciech A. Koszek
>Release:        FreeBSD 5.4-STABLE i386
>Organization:
>Environment:
System: FreeBSD dunstan.freebsd.czest.pl 5.4-STABLE FreeBSD 5.4-STABLE #5: Sun May 8 11:57:11 CEST 2005 dunstan at dunstan.freebsd.czest.pl:/usr/obj/usr/src/sys/HOME8 i386


>Description:
There is a redundant declaration ("int error") in sys/netgraph/ng_socket.c. 
'error' is declared in ngc_send() and initialized with zero. Second 'error'
is declared in block responsible for loading needed Netgraph modules. If
module does not exist (linker_load_module()), 'error' in block's scope is
equal to 2, but 'error' in function's scope is returned while it's value is
not changed (still equal to zero).
>How-To-Repeat:
root at dunstan:(/)# ls /boot/kernel/ng_device.ko
ls: /boot/kernel/ng_device.ko: No such file or directory
root at dunstan:(/)# ngctl 
[..]
+ mkpeer . device d d
+ list
There are 1 total nodes:
  Name: ngctl1040       Type: socket          ID: 00000001   Num hooks: 0


>Fix:
Patch [diff.0.ng_socket.c] removes second declaration of error. 

--- diff.0.ng_socket.c begins here ---
Index: src/sys/netgraph/ng_socket.c
===================================================================
RCS file: /home/ncvs/src/sys/netgraph/ng_socket.c,v
retrieving revision 1.64
diff -r1.64 ng_socket.c
286d285
< 			int error;
--- diff.0.ng_socket.c ends here ---

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


More information about the freebsd-bugs mailing list