diff options
author | edgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-11-13 21:10:25 +0000 |
---|---|---|
committer | edgar_igl <edgar_igl@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-11-13 21:10:25 +0000 |
commit | 9eee9a5dacf1a4e6a8bb4f19c05bfc87688a8549 (patch) | |
tree | bd77c51fc698b80c3eecb6152bde99e1ebc400ae /hw | |
parent | 10781c09ed7ab6a0e36d7b8f1fbf7c49128eb177 (diff) |
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 <markmc@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5719 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw')
-rw-r--r-- | hw/etraxfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/etraxfs.c b/hw/etraxfs.c index 4f93cd81c3..2f6e2ee8da 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); |