[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 13/16] hw/pc.c: Fix use-while-uninitialized of fd_ty
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 13/16] hw/pc.c: Fix use-while-uninitialized of fd_type[] |
Date: |
Fri, 11 Nov 2011 18:39:25 +0100 |
From: Peter Maydell <address@hidden>
Fix a use-while-uninitialized of the fd_type[] array (introduced
in commit 34d4260e1, noticed by Coverity). This is more theoretical
than practical, since it's quite hard to get here with floppy==NULL
(the qdev_try_create() of the isa-fdc device has to fail).
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/pc.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 3015671..33778fe 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -335,7 +335,7 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t
above_4g_mem_size,
ISADevice *s)
{
int val, nb, nb_heads, max_track, last_sect, i;
- FDriveType fd_type[2];
+ FDriveType fd_type[2] = { FDRIVE_DRV_NONE, FDRIVE_DRV_NONE };
BlockDriverState *fd[MAX_FD];
static pc_cmos_init_late_arg arg;
@@ -385,8 +385,6 @@ void pc_cmos_init(ram_addr_t ram_size, ram_addr_t
above_4g_mem_size,
bdrv_get_floppy_geometry_hint(fd[i], &nb_heads, &max_track,
&last_sect, FDRIVE_DRV_NONE,
&fd_type[i]);
- } else {
- fd_type[i] = FDRIVE_DRV_NONE;
}
}
}
--
1.7.6.4
- [Qemu-devel] [PATCH 07/16] qemu-nbd: rename socket variable, (continued)
- [Qemu-devel] [PATCH 07/16] qemu-nbd: rename socket variable, Kevin Wolf, 2011/11/11
- [Qemu-devel] [PATCH 09/16] qemu-nbd: print error messages from the daemon through a pipe, Kevin Wolf, 2011/11/11
- [Qemu-devel] [PATCH 08/16] qemu-nbd: move client to a thread, Kevin Wolf, 2011/11/11
- [Qemu-devel] [PATCH 11/16] qemu-nbd: open the block device after starting the client thread, Kevin Wolf, 2011/11/11
- [Qemu-devel] [PATCH 15/16] block: Introduce bdrv_co_flush_to_os, Kevin Wolf, 2011/11/11
- [Qemu-devel] [PATCH 14/16] block: Rename bdrv_co_flush to bdrv_co_flush_to_disk, Kevin Wolf, 2011/11/11
- [Qemu-devel] [PATCH 16/16] block: Make cache=unsafe flush to the OS, Kevin Wolf, 2011/11/11
- [Qemu-devel] [PATCH 10/16] qemu-nbd: fix socket creation race, Kevin Wolf, 2011/11/11
- [Qemu-devel] [PATCH 12/16] block: Fix vpc initialization of the Dynamic Disk Header, Kevin Wolf, 2011/11/11
- [Qemu-devel] [PATCH 06/16] qemu-nbd: trap SIGTERM, Kevin Wolf, 2011/11/11
- [Qemu-devel] [PATCH 13/16] hw/pc.c: Fix use-while-uninitialized of fd_type[],
Kevin Wolf <=
- Re: [Qemu-devel] [PULL 00/16] Block patches for 1.0, Anthony Liguori, 2011/11/13