qemu-traditional: Fix build warnings on Wheezy
PATCH 1/1 qemu-traditional: Fix build warnings on Wheezy
CC i386-dm/eepro100.ohw/eepro100.c: In function ‘eepro100_read4’:hw/eepro100.c:1232:5: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized] hw/eepro100.c: In function ‘eepro100_read2’:hw/eepro100.c:1202:5: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized] hw/eepro100.c: In function ‘eepro100_read1’:hw/eepro100.c:1179:5: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Use ~0 to match the behaviour of real hardware.
---
FWIW, Coverity does not appear to believe there is an exit path from these functions with the uninitialised 'val'.
--- hw/eepro100.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/eepro100.c +3 -3
@@ -1136,7 +1136,7 @@ static void eepro100_write_port(EEPRO100State * s, uint32_t val)static uint8_t eepro100_read1 (EEPRO100State * s,uint32_t addr) { -uint8_t val; +uint8_t val = ~0 ;if (addr <=sizeof (s->mem) -sizeof (val)) {memcpy (&val, &s->mem[addr],sizeof (val)); }
@@ -1181,7 +1181,7 @@ static uint8_t eepro100_read1(EEPRO100State * s, uint32_t addr)static uint16_t eepro100_read2 (EEPRO100State * s,uint32_t addr) { -uint16_t val; +uint16_t val = ~0 ;if (addr <=sizeof (s->mem) -sizeof (val)) {memcpy (&val, &s->mem[addr],sizeof (val)); }
@@ -1204,7 +1204,7 @@ static uint16_t eepro100_read2(EEPRO100State * s, uint32_t addr)static uint32_t eepro100_read4 (EEPRO100State * s,uint32_t addr) { -uint32_t val; +uint32_t val = ~0U ;if (addr <=sizeof (s->mem) -sizeof (val)) {memcpy (&val, &s->mem[addr],sizeof (val)); }
Signature · 7 lines
1.7.10.4 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Andrew Cooper writes ("[PATCH] qemu-traditional: Fix build warnings on Wheezy"):
Quoted 8 lines
CC
i386-dm/eepro100.ohw/eepro100.c: In function ‘eepro100_read4’:hw/eepro100.c:1232:5: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]hw/eepro100.c: In function ‘eepro100_read2’:hw/eepro100.c:1202:5: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]hw/eepro100.c: In function ‘eepro100_read1’:hw/eepro100.c:1179:5: warning: ‘val’ may be used uninitialized in this function [-Wmaybe-uninitialized]
Quoted 5 lines
Use ~0 to match the behaviour of real hardware.
Signed-off-by Andrew Cooper <[email protected]>CC Ian Campbell <[email protected]>CC Ian Jackson <[email protected]>
and queued for backport
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel