NetBSD-Bugs archive

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

kern/51460: Source code bugs

>Number:         51460
>Category:       kern
>Synopsis:       Source code bugs
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 03 16:15:00 +0000 2016
>Originator:     Ray Phillips
>Release:        7.0.1
NetBSD 7.0.1 NetBSD 7.0.1 (GENERIC.201605221355Z) amd64
I hesitate to submit this report because I've no experience with kernel programming.  Hopefully it's not a bogus report...

I've been attempting to get Hubert Feyrer's g4u 2.6beta1:

to build with NetBSD 7.0.1 source code and found it was necessary to edit two files in the 7.0.1 source to get them to compile:


The errors were (as shown in the "Fix to the problem if known" section of this send-pr):

/usr/src/sys/dev/acpi/fujhk_acpi.c:262:10: error: 'irb' may be used uninitialized in this function

/usr/src/sys/kern/core_elf32.c:513:12: error: conflicting types for 'coredump_elf32'
It's probably not necessary, but if you like I can send you my modified g4u-2.6beta1.tgz if you want to follow the same steps I have, but you can see from the error messages why the compile stopped.

They're obviously not critical problems since NetBSD/i386 7.0.1 has been compiled successfully and released.  I suppose the g4u-build script must use different compiler settings to have produced these errors.
Edit  ./sys/dev/acpi/fujhk_acpi.c :

# diff -u ./sys/dev/acpi/fujhk_acpi.c.orig ./sys/dev/acpi/fujhk_acpi.c
--- ./sys/dev/acpi/fujhk_acpi.c.orig    2016-08-31 21:55:27.000000000 +1000
+++ ./sys/dev/acpi/fujhk_acpi.c 2016-08-31 22:13:25.000000000 +1000
@@ -246,6 +246,7 @@
        uint32_t irb;
        int i, index;

+       irb = 0; /* make sure irb has been initialized */
        for (i = 0; i < max_irb_buffer_size; i++) {
                if (fujitsu_hk_get_irb(sc, &irb) || irb == 0)

Without that change this error occurred:

#   compile  G4U-KERNEL/fujhk_acpi.o
/usr/src/obj.i386/tooldir-NetBSD/bin/i486--netbsdelf-gcc -msoft-float -mno-mmx -
mno-sse -mno-avx -ffreestanding -fno-zero-initialized-in-bss -g -Os -fstack-prot
ector -Wstack-protector --param ssp-buffer-size=1 -fno-strict-aliasing -fno-comm
on -std=gnu99 -Werror -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith -W
missing-prototypes -Wstrict-prototypes -Wold-style-definition -Wswitch -Wshadow
-Wcast-qual -Wwrite-strings -Wno-unreachable-code -Wno-pointer-sign -Wno-attribu
tes -Wextra -Wno-unused-parameter -Wold-style-definition -Wno-sign-compare -marc
h=i486 -mtune=pentiumpro --sysroot=/usr/src/obj.i386/destdir -Di386 -I. -I/usr/s
rc/sys/../common/include -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DCHILD_MA
 -D_KERNEL_OPT -std=gnu99 -I/usr/src/sys/lib/libkern/../../../common/lib/libc/qu
ad -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/sr
c/sys/external/isc/atheros_hal/dist -I/usr/src/sys/external/isc/atheros_hal/ic -
I/usr/src/sys/external/bsd/acpica/dist/include -c /usr/src/sys/dev/acpi/fujhk_ac
/usr/src/sys/dev/acpi/fujhk_acpi.c: In function 'fujitsu_hk_event_callback':
/usr/src/sys/dev/acpi/fujhk_acpi.c:262:10: error: 'irb' may be used uninitialized in this function [-Werror=maybe-uninitialized]
cc1: all warnings being treated as errors

*** Failed target:  fujhk_acpi.o

Edit  ./sys/kern/core_elf32.c  :

# diff -u ./sys/kern/core_elf32.c.orig ./sys/kern/core_elf32.c
--- ./sys/kern/core_elf32.c.orig        2016-08-31 15:24:19.000000000 +1000
+++ ./sys/kern/core_elf32.c     2016-08-31 17:32:59.000000000 +1000
@@ -510,7 +510,7 @@
 #else  /* COREDUMP */

-ELFNAMEEND(coredump)(struct lwp *l, void *cookie)
+ELFNAMEEND(coredump)(struct lwp *l, struct coredump_iostate *cookie)

        return ENOSYS;

Without that change this error occurred:

#   compile  G4U-KERNEL/core_elf32.o
/usr/src/obj.i386/tooldir-NetBSD/bin/i486--netbsdelf-gcc -msoft-float -mno-mmx -mno-sse -mno-avx -ffreestanding -fno-zero-initialized-in-bss -g -Os -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 -march=i486 -mtune=pentiumpro --sysroot=/usr/src/obj.i386/destdir -Di386 -I. -I/usr/src/sys/../common/include -I/usr/src/sys/arch -I/usr/src/sys -nostdinc -DCHILD_MAX=1024 -DOPEN_MAX=1024 -DMSGBUFSIZE=50000 -DHALT_ON_PANIC -DMAXUSERS=2 -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/isc/atheros_hal/dist -I/usr/src/sys/external/isc/atheros_hal/ic -I/usr/src/sys/external/bsd/acpica/dist/include -c /usr/src/sys/kern/core_elf32.c
In file included from /usr/src/sys/kern/core_elf32.c:42:0:
/usr/src/sys/kern/core_elf32.c:513:12: error: conflicting types for 'coredump_elf32'
 ELFNAMEEND(coredump)(struct lwp *l, void *cookie)
/usr/src/sys/sys/cdefs.h:93:23: note: in definition of macro '__CONCAT'
 #define __CONCAT(x,y) x ## y
/usr/src/sys/sys/exec_elf.h:1029:23: note: in expansion of macro 'CONCAT'
/usr/src/sys/kern/core_elf32.c:513:1: note: in expansion of macro 'ELFNAMEEND'
 ELFNAMEEND(coredump)(struct lwp *l, void *cookie)
In file included from /usr/src/sys/kern/core_elf32.c:58:0:
/usr/src/sys/sys/exec_elf.h:1286:5: note: previous declaration of 'coredump_elf32' was here
 int coredump_elf32(struct lwp *, struct coredump_iostate *);

*** Failed target:  core_elf32.o

Home | Main Index | Thread Index | Old Index