buildkernel failure at posix semaphores

From: KT Sin <sinkeyteck_at_yahoo.com>
Date: Wed, 17 Aug 2011 13:48:33 +0800
buildkernel is failing at uipc_sem.c and uipc_shm.c when mac is not enabled.

===> sem (all)
cc -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc   -DHAVE_KERNEL_OPTION_HEADERS -include /tmp/obj/usr/src/sys/PASSION/opt_global.h -I. -I_at_ -I_at_/contrib/altq -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common  -fno-omit-frame-pointer -I/tmp/obj/usr/src/sys/PASSION  -mno-sse -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -std=iso9899:1999 -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs -fdiagnostics-show-option -c /usr/src/sys/modules/sem/../../kern/uipc_sem.c
cc1: warnings being treated as errors
/usr/src/sys/modules/sem/../../kern/uipc_sem.c: In function 'ksem_chown':
/usr/src/sys/modules/sem/../../kern/uipc_sem.c:271: warning: 'error' may be used uninitialized in this function
*** Error code 1
1 error
*** Error code 2
1 error
*** Error code 2
2 errors
*** Error code 2
1 error
*** Error code 2
1 error

cc -c -O2 -frename-registers -pipe -fno-strict-aliasing  -std=c99  -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000  -fno-omit-frame-pointer -mno-sse -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror  /usr/src/sys/kern/uipc_shm.c
cc1: warnings being treated as errors
/usr/src/sys/kern/uipc_shm.c: In function 'shm_chown':
/usr/src/sys/kern/uipc_shm.c:700: warning: 'error' may be used uninitialized in this function
*** Error code 1

Stop in /tmp/obj/usr/src/sys/PASSION.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.


suggested fix:

--- sys/kern/uipc_sem.c.orig    2011-08-17 13:16:52.000000000 +0800
+++ sys/kern/uipc_sem.c 2011-08-17 13:23:28.000000000 +0800
_at__at_ -270,6 +270,7 _at__at_
        struct ksem *ks;
        int error;

+       error = 0;
        ks = fp->f_data;
        mtx_lock(&sem_lock);
 #ifdef MAC
--- sys/kern/uipc_shm.c.orig    2011-08-17 13:16:52.000000000 +0800
+++ sys/kern/uipc_shm.c 2011-08-17 13:25:37.000000000 +0800
_at__at_ -699,6 +699,7 _at__at_
        struct shmfd *shmfd;
        int error;

+       error = 0;
        shmfd = fp->f_data;
        mtx_lock(&shm_timestamp_lock);
 #ifdef MAC
Received on Wed Aug 17 2011 - 03:48:49 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:16 UTC