[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Build break (uninitialized variable)
From: |
Grégoire Sutre |
Subject: |
Build break (uninitialized variable) |
Date: |
Fri, 03 Feb 2012 19:26:11 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111114 Iceowl/1.0b2 Icedove/3.1.16 |
The compiler complains about `totsize' being possibly uninitialized
in grub-core/disk/diskfilter.c, function grub_diskfilter_make_raid().
I get this error with gcc 4.5.3 on NetBSD, and also with gcc 4.6.2 on
Debian GNU/Linux.
I'm not familiar with that code. The attached patch fixes this by
returning NULL when the argument `level' has an unexpected value.
Grégoire
gcc -DHAVE_CONFIG_H -I. -I.. -Wall -W -I../include -I../include
-DGRUB_MACHINE_PCBIOS=1 -DGRUB_MACHINE=I386_PC -DGRUB_TARGET_CPU_I386=1
-m32 -DGRUB_FILE=\"disk/diskfilter.c\" -I. -I. -I.. -I.. -I../include
-I../include -Os -Wall -W -Wshadow -Wpointer-arith
-Wmissing-prototypes -Wundef -Wstrict-prototypes -g -falign-jumps=1
-falign-loops=1 -falign-functions=1 -mno-mmx -mno-sse -mno-sse2
-mno-3dnow -fno-dwarf2-cfi-asm -fno-asynchronous-unwind-tables -m32
-fno-stack-protector -mno-stack-arg-probe -Werror -mrtd -mregparm=3
-ffreestanding -MT disk/diskfilter_module-diskfilter.o -MD -MP -MF
disk/.deps-core/diskfilter_module-diskfilter.Tpo -c -o
disk/diskfilter_module-diskfilter.o `test -f 'disk/diskfilter.c' || echo
'./'`disk/diskfilter.c
cc1: warnings being treated as errors
disk/diskfilter.c: In function 'grub_diskfilter_make_raid':
disk/diskfilter.c:813:17: error: 'totsize' may be used uninitialized in
this function
gmake[3]: *** [disk/diskfilter_module-diskfilter.o] Error 1
gmake[3]: Leaving directory `/tmp/grub/grub-core'
gmake[2]: *** [all] Error 2
gmake[2]: Leaving directory `/tmp/grub/grub-core'
gmake[1]: *** [all-recursive] Error 1
gmake[1]: Leaving directory `/tmp/grub'
gmake: *** [all] Error 2
diskfilter-totsize.diff
Description: Text Data
- Build break (uninitialized variable),
Grégoire Sutre <=