From 5d630294b14759c26346f2fb762c8f3415d9f8ae Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 18 Jan 2012 10:38:03 +0100 Subject: [PATCH 09/52] eepro100: initialize a variable in all cases RH-Author: Markus Armbruster Message-id: <1326883126-22053-10-git-send-email-armbru@redhat.com> Patchwork-id: 36571 O-Subject: [RHEL-6.3 PATCH qemu-kvm 09/52] eepro100: initialize a variable in all cases Bugzilla: 758194 RH-Acked-by: Laszlo Ersek RH-Acked-by: Miroslav Rezanina RH-Acked-by: Amit Shah From: Blue Swirl 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. Signed-off-by: Blue Swirl (cherry picked from commit ef4760626e88bc3e7a1b46c7370378cbd12d379f) Signed-off-by: Markus Armbruster --- hw/eepro100.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Signed-off-by: Michal Novotny --- hw/eepro100.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/eepro100.c b/hw/eepro100.c index febb48c..8002fc1 100644 --- a/hw/eepro100.c +++ b/hw/eepro100.c @@ -1270,7 +1270,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)); } @@ -1315,7 +1315,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)); } @@ -1339,7 +1339,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 = 0; if (addr <= sizeof(s->mem) - sizeof(val)) { memcpy(&val, &s->mem[addr], sizeof(val)); } -- 1.7.7.5