diff mbox

[v2,01/13] vvfat: fix qemu-img map and qemu-img convert

Message ID 20170522211205.14265-2-hpoussin@reactos.org
State New
Headers show

Commit Message

Hervé Poussineau May 22, 2017, 9:11 p.m. UTC
- bs->total_sectors is the number of sectors of the whole disk
- s->sector_count is the number of sectors of the FAT partition

This fixes the following assert in qemu-img map:
qemu-img.c:2641: get_block_status: Assertion `nb_sectors' failed.

This also fixes an infinite loop in qemu-img convert.

Fixes: 4480e0f924a42e1db8b8cfcac4d0634dd1bb27a0
Fixes: https://bugs.launchpad.net/qemu/+bug/1599539
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
 block/vvfat.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Eric Blake May 22, 2017, 9:17 p.m. UTC | #1
On 05/22/2017 04:11 PM, Hervé Poussineau wrote:
> - bs->total_sectors is the number of sectors of the whole disk
> - s->sector_count is the number of sectors of the FAT partition
> 
> This fixes the following assert in qemu-img map:
> qemu-img.c:2641: get_block_status: Assertion `nb_sectors' failed.
> 
> This also fixes an infinite loop in qemu-img convert.
> 
> Fixes: 4480e0f924a42e1db8b8cfcac4d0634dd1bb27a0
> Fixes: https://bugs.launchpad.net/qemu/+bug/1599539
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
> ---
>  block/vvfat.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

I gave Reviewed-by: on version 1, and suggested that this be cc'd to
qemu-stable:
https://lists.gnu.org/archive/html/qemu-devel/2017-05/msg03622.html

It helps to add that into the commit message for v2, to make it clear
that you haven't changed anything in this commit since that review.
diff mbox

Patch

diff --git a/block/vvfat.c b/block/vvfat.c
index 9c82371360..df24091bf6 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -2969,8 +2969,7 @@  vvfat_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
 static int64_t coroutine_fn vvfat_co_get_block_status(BlockDriverState *bs,
 	int64_t sector_num, int nb_sectors, int *n, BlockDriverState **file)
 {
-    BDRVVVFATState* s = bs->opaque;
-    *n = s->sector_count - sector_num;
+    *n = bs->total_sectors - sector_num;
     if (*n > nb_sectors) {
         *n = nb_sectors;
     } else if (*n < 0) {