Skip to contentSkip to conversation

[5719] ETRAX-FS: Fix a segfault if pflash drive not found.

Qemu-devel Edgar E. Iglesias 1 participant 1 message Nov 13, 2008

lore
Share & tools
lore
#0 lore raw

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.

Modified Paths:
--------------
trunk/hw/etraxfs.c

Modified: trunk/hw/etraxfs.c
===================================================================

hw/etraxfs.c +1 -1
@@ -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);