summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaofei Lee <hbuxiaofei@gmail.com>2022-11-21 22:54:10 +0800
committerKevin O'Connor <kevin@koconnor.net>2022-11-22 13:11:49 -0500
commit85d56f812f4d020b3b486682aff07d9f4a4c60fe (patch)
tree6ed7821413e37caf2e5819ba3920b6794622d169
parent46de2eec93bffa0706e6229c0da2919763c8eb04 (diff)
downloadqemu-seabios-85d56f812f4d020b3b486682aff07d9f4a4c60fe.tar.gz
virtio-blk: Fix incorrect type conversion in virtio_blk_op()
When using spdk aio bdev driver, the qemu command line like this: qemu-system-x86_64 \ -chardev socket,id=char0,path=/tmp/vhost.0 \ -device vhost-user-blk-pci,id=blk0,chardev=char0 \ ... Boot failure message as below: e820 map has 7 items: 0: 0000000000000000 - 000000000009fc00 = 1 RAM 1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED 2: 00000000000f0000 - 0000000000100000 = 2 RESERVED 3: 0000000000100000 - 000000007ffdd000 = 1 RAM 4: 000000007ffdd000 - 0000000080000000 = 2 RESERVED 5: 00000000feffc000 - 00000000ff000000 = 2 RESERVED 6: 00000000fffc0000 - 0000000100000000 = 2 RESERVED enter handle_19: NULL Booting from Hard Disk... Boot failed: could not read the boot disk Fixes: a05af290bac5 ("virtio-blk: split large IO according to size_max") Acked-by: Andy Pei <andy.pei@intel.com> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Paul Menzel <pmenzel@molgen.mpg.de> Signed-off-by: Xiaofei Lee <hbuxiaofei@gmail.com>
-rw-r--r--src/hw/virtio-blk.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c
index 9b4a05a..ce3265e 100644
--- a/src/hw/virtio-blk.c
+++ b/src/hw/virtio-blk.c
@@ -92,7 +92,7 @@ virtio_blk_op(struct disk_op_s *op, int write)
u16 blk_num_max;
if (vdrive->drive.blksize != 0 && max_io_size != 0)
- blk_num_max = (u16)max_io_size / vdrive->drive.blksize;
+ blk_num_max = (u16)(max_io_size / vdrive->drive.blksize);
else
/* default blk_num_max if hardware doesnot advise a proper value */
blk_num_max = 64;