From patchwork Wed Oct 6 21:32:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 66972 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 93F45B70D1 for ; Thu, 7 Oct 2010 08:37:11 +1100 (EST) Received: from localhost ([127.0.0.1]:46551 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3bff-0001ZN-1V for incoming@patchwork.ozlabs.org; Wed, 06 Oct 2010 17:37:07 -0400 Received: from [140.186.70.92] (port=60512 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3bbm-00083i-Np for qemu-devel@nongnu.org; Wed, 06 Oct 2010 17:33:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P3bbi-0006eE-97 for qemu-devel@nongnu.org; Wed, 06 Oct 2010 17:33:06 -0400 Received: from mail-qy0-f173.google.com ([209.85.216.173]:61465) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P3bbi-0006dz-6s for qemu-devel@nongnu.org; Wed, 06 Oct 2010 17:33:02 -0400 Received: by qyk32 with SMTP id 32so3593917qyk.4 for ; Wed, 06 Oct 2010 14:33:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=hMLIKUX+eI+UtibjidSP9YmsjnDeQrw+53RmYDoDIZ4=; b=RBgnBogv8rZt5ACWebcr5uyXyOrCa/tH2aHKmugbHEKDADlsz3pv+xeQjR77OmhG2w y0YIv7A5WOdD/oWNKlXtjooV2LuzXWYEXufT0NEYc4NAMNTyLQGUlxv2jI5M2Mk8MibN NHM4VqWpBJTtbssqobwNsd7FuEDeYmDLY8tLA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=mhBWX2COldPQLtUG7B16BDFoFQTejyTAztnFSWd2CSXcu4xO8R5pCHm7jh/G2+2Xn2 uLLls5TUnHPYD6vY+AO27kKKl74Y2xrziR0P3IixCUBS+tnPn9hIziuSRI9O0JFmWXBx tk1bfEhXsNRwaSh8o0ULvNdkdgvkup7VcuJIA= Received: by 10.224.65.95 with SMTP id h31mr9715313qai.116.1286400777585; Wed, 06 Oct 2010 14:32:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.31.139 with HTTP; Wed, 6 Oct 2010 14:32:37 -0700 (PDT) From: Blue Swirl Date: Wed, 6 Oct 2010 21:32:37 +0000 Message-ID: To: qemu-devel , Stefan Weil X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Subject: [Qemu-devel] [PATCH 03/11] eepro100: initialize a variable in all cases X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- hw/eepro100.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) } @@ -1325,7 +1325,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)); } @@ -1348,7 +1348,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)); } diff --git a/hw/eepro100.c b/hw/eepro100.c index 2b75c8f..adc579f 100644 --- a/hw/eepro100.c +++ b/hw/eepro100.c @@ -1282,7 +1282,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));