Am 07.10.2010 11:31, schrieb Markus Armbruster:
Blue Swirl <blauwir...@gmail.com> writes:

Compiling with GCC 4.6.0 20100925 produced warnings:
/src/qemu/hw/eepro100.c: In function 'eepro100_read4':
/src/qemu/hw/eepro100.c:1351:14: error: 'val' may be used
uninitialized in this function [-Werror=uninitialized]
/src/qemu/hw/eepro100.c: In function 'eepro100_read2':
/src/qemu/hw/eepro100.c:1328:14: error: 'val' may be used
uninitialized in this function [-Werror=uninitialized]
/src/qemu/hw/eepro100.c: In function 'eepro100_read1':
/src/qemu/hw/eepro100.c:1285:13: error: 'val' may be used
uninitialized in this function [-Werror=uninitialized]

Fix by initializing 'val' at start.

I'm worried this sweeps bugs under the carpet.

When addr is out of bounds, these function return garbage. Your patch
makes them return 0 instead. Can that happen? Shouldn't we catch and
flag it?

We should.

I'll test new code which uses an assertion instead of the if statements,
so a new patch might be ready until end of next week.

Blue Swirl's patch does no harm, so it could be applied
nevertheless if compiler warnings should be fixed now
(I had the same kind of patch in my queue).

Stefan


Reply via email to