aboutsummaryrefslogtreecommitdiff
path: root/qemu-img.c
diff options
context:
space:
mode:
authorNir Soffer <nirsof@gmail.com>2019-08-27 21:59:12 +0300
committerMax Reitz <mreitz@redhat.com>2019-09-16 14:48:30 +0200
commit1bbbf32d5fffe334531c315d7bd865fdfb67b6c5 (patch)
treee8f70cc6cd882948f07a8dd568b625ab7bac2e3e /qemu-img.c
parentdd25f97c66a75d1508f1d4c6478ed2c95bec428f (diff)
block: Use QEMU_IS_ALIGNED
Replace instances of: (n & (BDRV_SECTOR_SIZE - 1)) == 0 And: (n & ~BDRV_SECTOR_MASK) == 0 With: QEMU_IS_ALIGNED(n, BDRV_SECTOR_SIZE) Which reveals the intent of the code better, and makes it easier to locate the code checking alignment. Signed-off-by: Nir Soffer <nsoffer@redhat.com> Message-id: 20190827185913.27427-2-nsoffer@redhat.com Reviewed-by: John Snow <jsnow@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r--qemu-img.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/qemu-img.c b/qemu-img.c
index 4ee436fc94..384c6f38bc 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2141,7 +2141,7 @@ static int img_convert(int argc, char **argv)
int64_t sval;
sval = cvtnum(optarg);
- if (sval < 0 || sval & (BDRV_SECTOR_SIZE - 1) ||
+ if (sval < 0 || !QEMU_IS_ALIGNED(sval, BDRV_SECTOR_SIZE) ||
sval / BDRV_SECTOR_SIZE > MAX_BUF_SECTORS) {
error_report("Invalid buffer size for sparse output specified. "
"Valid sizes are multiples of %llu up to %llu. Select "