Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 May 2005 20:46:31 GMT
From:      "Wojciech A. Koszek" <dunstan@freebsd.czest.pl>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/81371: [PATCH] ng_socket: 2nd "int error" hides real error code
Message-ID:  <200505222046.j4MKkVxg050103@freebsd.czest.pl>
Resent-Message-ID: <200505222040.j4MKe6YV050655@freefall.freebsd.org>

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

>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@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@dunstan:(/)# ls /boot/kernel/ng_device.ko
ls: /boot/kernel/ng_device.ko: No such file or directory
root@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:



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