Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L0jSO-00027L-A8 for qemu-devel@nongnu.org; Thu, 13 Nov 2008 16:10:28 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L0jSN-00026X-Lh for qemu-devel@nongnu.org; Thu, 13 Nov 2008 16:10:27 -0500 Received: from [199.232.76.173] (port=53317 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0jSN-00026A-0c for qemu-devel@nongnu.org; Thu, 13 Nov 2008 16:10:27 -0500 Received: from savannah.gnu.org ([199.232.41.3]:59050 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L0jSM-00073V-Ns for qemu-devel@nongnu.org; Thu, 13 Nov 2008 16:10:26 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1L0jSM-0003gV-9v for qemu-devel@nongnu.org; Thu, 13 Nov 2008 21:10:26 +0000 Received: from edgar_igl by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1L0jSM-0003gP-0c for qemu-devel@nongnu.org; Thu, 13 Nov 2008 21:10:26 +0000 MIME-Version: 1.0 Errors-To: edgar_igl Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: "Edgar E. Iglesias" Message-Id: Date: Thu, 13 Nov 2008 21:10:26 +0000 Subject: [Qemu-devel] [5719] ETRAX-FS: Fix a segfault if pflash drive not found. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5719 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5719 Author: edgar_igl Date: 2008-11-13 21:10:25 +0000 (Thu, 13 Nov 2008) Log Message: ----------- ETRAX-FS: Fix a segfault if pflash drive not found. drive_get_index() returns -1 if a drive isn't found; don't use -1 to index drives_table. Signed-off-by: Mark McLoughlin Signed-off-by: Edgar E. Iglesias Modified Paths: -------------- trunk/hw/etraxfs.c Modified: trunk/hw/etraxfs.c =================================================================== --- trunk/hw/etraxfs.c 2008-11-13 19:37:46 UTC (rev 5718) +++ trunk/hw/etraxfs.c 2008-11-13 21:10:25 UTC (rev 5719) @@ -83,7 +83,7 @@ phys_flash = qemu_ram_alloc(FLASH_SIZE); i = drive_get_index(IF_PFLASH, 0, 0); pflash_cfi02_register(0x0, phys_flash, - drives_table[i].bdrv, (64 * 1024), + i != -1 ? drives_table[i].bdrv : NULL, (64 * 1024), FLASH_SIZE >> 16, 1, 2, 0x0000, 0x0000, 0x0000, 0x0000, 0x555, 0x2aa);