Blame SOURCES/kvm-qemu-img-Fix-assert-when-mapping-unaligned-raw-file.patch

357786
From bd6ce734563c0308b021c013f1e622ff185be60b Mon Sep 17 00:00:00 2001
357786
From: Max Reitz <mreitz@redhat.com>
357786
Date: Mon, 6 Aug 2018 16:35:52 +0200
357786
Subject: [PATCH 03/13] qemu-img: Fix assert when mapping unaligned raw file
357786
357786
RH-Author: Max Reitz <mreitz@redhat.com>
357786
Message-id: <20180806163553.13344-2-mreitz@redhat.com>
357786
Patchwork-id: 81647
357786
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 1/2] qemu-img: Fix assert when mapping unaligned raw file
357786
Bugzilla: 1601310
357786
RH-Acked-by: Eric Blake <eblake@redhat.com>
357786
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
357786
RH-Acked-by: John Snow <jsnow@redhat.com>
357786
357786
From: Eric Blake <eblake@redhat.com>
357786
357786
Commit a290f085 exposed a latent bug in qemu-img map introduced
357786
during the conversion of block status to be byte-based.  Earlier in
357786
commit 5e344dd8, the internal interface get_block_status() switched
357786
to take byte-based parameters, but still called a sector-based
357786
block layer function; as such, rounding was added in the lone
357786
caller to obey the contract.  However, commit 237d78f8 changed
357786
get_block_status() to truly be byte-based, at which point rounding
357786
to sector boundaries can result in calling bdrv_block_status() with
357786
'bytes == 0' (a coding error) when the boundary between data and a
357786
hole falls mid-sector (true for the past-EOF implicit hole present
357786
in POSIX files).  Fix things by removing the rounding that is now
357786
no longer necessary.
357786
357786
See also https://bugzilla.redhat.com/1589738
357786
357786
Fixes: 237d78f8
357786
Reported-by: Dan Kenigsberg <danken@redhat.com>
357786
Reported-by: Nir Soffer <nsoffer@redhat.com>
357786
Reported-by: Maor Lipchuk <mlipchuk@redhat.com>
357786
CC: qemu-stable@nongnu.org
357786
Signed-off-by: Eric Blake <eblake@redhat.com>
357786
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
357786
(cherry picked from commit e0b371ed5e2db079051139136fd0478728b6a58f)
357786
Signed-off-by: Max Reitz <mreitz@redhat.com>
357786
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
357786
---
357786
 qemu-img.c | 2 +-
357786
 1 file changed, 1 insertion(+), 1 deletion(-)
357786
357786
diff --git a/qemu-img.c b/qemu-img.c
357786
index c9ccc1e..f42750a 100644
357786
--- a/qemu-img.c
357786
+++ b/qemu-img.c
357786
@@ -2925,7 +2925,7 @@ static int img_map(int argc, char **argv)
357786
         int64_t n;
357786
 
357786
         /* Probe up to 1 GiB at a time.  */
357786
-        n = QEMU_ALIGN_DOWN(MIN(1 << 30, length - offset), BDRV_SECTOR_SIZE);
357786
+        n = MIN(1 << 30, length - offset);
357786
         ret = get_block_status(bs, offset, n, &next;;
357786
 
357786
         if (ret < 0) {
357786
-- 
357786
1.8.3.1
357786