From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L0fHo-000250-Lv for qemu-devel@nongnu.org; Thu, 13 Nov 2008 11:43:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L0fHm-00023f-UT for qemu-devel@nongnu.org; Thu, 13 Nov 2008 11:43:16 -0500 Received: from [199.232.76.173] (port=38122 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L0fHl-00023E-HV for qemu-devel@nongnu.org; Thu, 13 Nov 2008 11:43:13 -0500 Received: from mail21.svc.cra.dublin.eircom.net ([159.134.118.222]:46704) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1L0fHl-00086M-KP for qemu-devel@nongnu.org; Thu, 13 Nov 2008 11:43:13 -0500 From: Mark McLoughlin Date: Thu, 13 Nov 2008 16:42:06 +0000 Message-Id: <1226594526-1855-3-git-send-email-markmc@redhat.com> In-Reply-To: <1226594526-1855-2-git-send-email-markmc@redhat.com> References: <> <1226594526-1855-1-git-send-email-markmc@redhat.com> <1226594526-1855-2-git-send-email-markmc@redhat.com> Subject: [Qemu-devel] [PATCH 3/3] cris: 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: Anthony Liguori Cc: Mark McLoughlin , qemu-devel@nongnu.org drive_get_index() returns -1 if a drive isn't found; don't use -1 to index drives_table. Signed-off-by: Mark McLoughlin --- hw/etraxfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/etraxfs.c b/hw/etraxfs.c index 4f93cd8..2f6e2ee 100644 --- a/hw/etraxfs.c +++ b/hw/etraxfs.c @@ -83,7 +83,7 @@ void bareetraxfs_init (ram_addr_t ram_size, int vga_ram_size, 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); -- 1.5.4.3