aboutsummaryrefslogtreecommitdiff
path: root/hw/fdc.c
diff options
context:
space:
mode:
authorj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-04 17:17:08 +0000
committerj_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162>2007-11-04 17:17:08 +0000
commitd6c1a327a94437f0ed74ba970b97fd962462bc77 (patch)
treea228d80ed5c09401d6f31152fa784db3d095df02 /hw/fdc.c
parenta06e5a3c6448befb8d5c1ac046cb41fc100f2cac (diff)
downloadqemu-d6c1a327a94437f0ed74ba970b97fd962462bc77.zip
qemu-d6c1a327a94437f0ed74ba970b97fd962462bc77.tar.gz
qemu-d6c1a327a94437f0ed74ba970b97fd962462bc77.tar.bz2
Fix memory corruption: bdrv_read/write API has been changed to take
nb_sectors instead of len in bytes but the fdc driver has never been fixed. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3532 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/fdc.c')
-rw-r--r--hw/fdc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/hw/fdc.c b/hw/fdc.c
index c6e2362..db76acb 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1213,8 +1213,7 @@ static uint32_t fdctrl_read_data (fdctrl_t *fdctrl)
len = fdctrl->data_len - fdctrl->data_pos;
if (len > FD_SECTOR_LEN)
len = FD_SECTOR_LEN;
- bdrv_read(cur_drv->bs, fd_sector(cur_drv),
- fdctrl->fifo, len);
+ bdrv_read(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1);
}
}
retval = fdctrl->fifo[pos];
@@ -1321,8 +1320,7 @@ static void fdctrl_write_data (fdctrl_t *fdctrl, uint32_t value)
fdctrl->fifo[fdctrl->data_pos++] = value;
if (fdctrl->data_pos % FD_SECTOR_LEN == (FD_SECTOR_LEN - 1) ||
fdctrl->data_pos == fdctrl->data_len) {
- bdrv_write(cur_drv->bs, fd_sector(cur_drv),
- fdctrl->fifo, FD_SECTOR_LEN);
+ bdrv_write(cur_drv->bs, fd_sector(cur_drv), fdctrl->fifo, 1);
}
/* Switch from transfer mode to status mode
* then from status mode to command mode