NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/49493: clang warning about uninitialized in ipfilter without INET6



>Number:         49493
>Category:       kern
>Synopsis:       clang warning about uninitialized in ipfilter without INET6
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 21 21:20:00 +0000 2014
>Originator:     Antoine Leca
>Release:        current as about 2014-12-07
>Organization:
>Environment:
NetBSD/i386 from http://nyftp.netbsd.org/pub/NetBSD-daily/HEAD-llvm/201411160850Z/images/NetBSD-7.99.1-i386-install.img.gz
(sorry, that kernel is not available any more for uname)
>Description:
While building with clang a new kernel *without* INET6, I got
...
    compile  NB100/ip_proxy.o
In file included from /usr/src/sys/external/bsd/ipf/netinet/ip_proxy.c:92:
/usr/src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c:500:6: error: variable 'nat2' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
        if (nat->nat_v[0] == 6) {
            ^~~~~~~~~~~~~~~~~~
/usr/src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c:527:6: note: uninitialized use occurs here
        if (nat2 != NULL)
            ^~~~
/usr/src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c:500:2: note: remove the 'if' if its condition is always false
        if (nat->nat_v[0] == 6) {
        ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/external/bsd/ipf/netinet/ip_ftp_pxy.c:443:13: note: initialize the variable 'nat2' to silence this warning
        nat_t *nat2;
                   ^
                    = NULL
1 error generated.

*** Failed target:  ip_proxy.o
*** Failed command: echo ' ' "compile NB100/ip_proxy.o" && : echo /usr/lltools/bin/i486--netbsdelf-clang -msoft-float -mno-mmx -mno-sse -mno-avx -ffreestanding -fno-zero-initialized-in-bss -O2 -fno-omit-frame-pointer -fstack-protector -Wstack-protector --param ssp-buffer-size=1 -fno-strict-aliasing -fno-common -std=gnu99 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-pointer-sign -Wno-attributes -Wextra -Wno-unused-parameter -Wold-style-definition -Wno-sign-compare -Wno-unknown-pragmas -Wno-conversion -Wno-self-assign --sysroot=/home/antoine/obj.ll07/destdir.i386 -Di386 -I. -I/usr/src/sys/../common/include -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DDIAGNOSTIC -DMAXUSERS=8 -D_KERNEL -D_KERNEL_OPT -std=gnu99 -I/usr/src/sys/lib/libkern/../../../common/lib/libc/quad -I/usr/src/sys/lib/libkern/../../../common/lib/libc/string 
 -I/usr/src/sys/lib/libkern/../../../common/lib/libc/arch/i386/string -D_FORTIFY_SOURCE=2 -I/usr/src/sys/external/bsd/ipf -I/usr/src/sys/external/isc/atheros_hal/dist -I/usr/src/sys/external/isc/atheros_hal/ic -I/usr/src/sys/external/bsd/drm2/include -I/usr/src/sys/external/bsd/common/include -I/usr/src/sys/external/bsd/drm2/include -I/usr/src/sys/external/bsd/drm2/dist -I/usr/src/sys/external/bsd/drm2/dist/include -I/usr/src/sys/external/bsd/drm2/dist/include/drm -I/usr/src/sys/external/bsd/drm2/dist/uapi -I/usr/src/sys/external/bsd/common/include -D__KERNEL__ -I/usr/src/sys/../common/include -DCONFIG_AGP -I/usr/src/sys/external/bsd/drm2/dist/drm/i915 -I/usr/src/sys/external/bsd/drm2/i915drm -DCONFIG_DRM_I915_FBDEV -I/usr/src/sys/external/bsd/acpica/dist/include -c /usr/src/sys/external/bsd/ipf/netinet/ip_proxy.c && /usr/lltools/bin/i486--netbsdelf-clang -msoft-float -mno-mmx -mno-sse -mno-avx -ffreestanding -fno-zero-initialized-in-bss -O2 -fno-omit-frame-pointer -fstack-pr
 otector -Wstack-protector --param ssp-buffer-size=1 -fno-strict-aliasing -fno-common -std=gnu99 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -Wold-style-definition -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-pointer-sign -Wno-attributes -Wextra -Wno-unused-parameter -Wold-style-definition -Wno-sign-compare -Wno-unknown-pragmas -Wno-conversion -Wno-self-assign --sysroot=/home/antoine/obj.ll07/destdir.i386 -Di386 -I. -I/usr/src/sys/../common/include -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DDIAGNOSTIC -DMAXUSERS=8 -D_KERNEL -D_KERNEL_OPT -std=gnu99 -I/usr/src/sys/lib/libkern/../../../common/lib/libc/quad -I/usr/src/sys/lib/libkern/../../../common/lib/libc/string -I/usr/src/sys/lib/libkern/../../../common/lib/libc/arch/i386/string -D_FORTIFY_SOURCE=2 -I/usr/src/sys/external/bsd/ipf -I/usr/src/sys/external/isc/atheros_hal/dist -I/usr/src/sys/external/isc/atheros_hal/ic -I/usr/src/sys/ex
 ternal/bsd/drm2/include -I/usr/src/sys/external/bsd/common/include -I/usr/src/sys/external/bsd/drm2/include -I/usr/src/sys/external/bsd/drm2/dist -I/usr/src/sys/external/bsd/drm2/dist/include -I/usr/src/sys/external/bsd/drm2/dist/include/drm -I/usr/src/sys/external/bsd/drm2/dist/uapi -I/usr/src/sys/external/bsd/common/include -D__KERNEL__ -I/usr/src/sys/../common/include -DCONFIG_AGP -I/usr/src/sys/external/bsd/drm2/dist/drm/i915 -I/usr/src/sys/external/bsd/drm2/i915drm -DCONFIG_DRM_I915_FBDEV -I/usr/src/sys/external/bsd/acpica/dist/include -c /usr/src/sys/external/bsd/ipf/netinet/ip_proxy.c && :
*** Error code 1

Stop.
nbmake: stopped in /home/antoine/obj.ll07/sys/arch/i386/compile/NB100 
>How-To-Repeat:
* Take a system compiled by LLVM (HEAD-LLVM) on i386
* Create a variant configuration disabling INET6, name it NB100
$ ./build.sh -u -U -T /usr/lltools/ -O /home/antoine/obj.ll07/ -V HOST_CC=clang -V HOST_CXX=clang++ -V HAVE_LLVM=1 -V MKLLVM=yes -V MKSTDLICXX=yes -V MKGCC=no -V MKGCCCMDS=no -V SLOPPY_FLIST=yes -N1 kernel=NB100
>Fix:
I went on with the proposed
    nat_t *nat2 = NULL;
but it is completely beyond me to know if NULL is the correct initial value on line 443, or even whether the analysis performed by the compiler is indeed correct or not.

I only noticed that a similar fix was applied for the same reason (no INET6) on line 837 of the same ip_ftp_pxy.c file



Home | Main Index | Thread Index | Old Index