From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=47265 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P3ufy-0008FB-AO for qemu-devel@nongnu.org; Thu, 07 Oct 2010 13:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P3ufx-0008FT-60 for qemu-devel@nongnu.org; Thu, 07 Oct 2010 13:54:42 -0400 Received: from moutng.kundenserver.de ([212.227.17.8]:57838) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P3ufw-0008F2-Qw for qemu-devel@nongnu.org; Thu, 07 Oct 2010 13:54:41 -0400 Message-ID: <4CAE095B.1000000@mail.berlios.de> Date: Thu, 07 Oct 2010 19:54:35 +0200 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 03/11] eepro100: initialize a variable in all cases References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: Blue Swirl , qemu-devel Am 07.10.2010 11:31, schrieb Markus Armbruster: > Blue Swirl 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