]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
blkzone: fix report zones sector offset check
authorMasato Suzuki <masato.suzuki@wdc.com>
Tue, 23 Oct 2018 09:31:35 +0000 (18:31 +0900)
committerKarel Zak <kzak@redhat.com>
Tue, 23 Oct 2018 09:49:41 +0000 (11:49 +0200)
To catch an offset error, an offset should be begger than or equal to
a device size in the condition.

Signed-off-by: Masato Suzuki <masato.suzuki@wdc.com>
sys-utils/blkzone.c

index b6a3aa46cb299c6638bc900f522cc4a577d50937..1dcbdf500422f192137538cefe849b288f785017 100644 (file)
@@ -179,8 +179,9 @@ static int blkzone_report(struct blkzone_control *ctl)
 
        fd = init_device(ctl, O_RDONLY);
 
-       if (ctl->offset > ctl->total_sectors)
-               errx(EXIT_FAILURE, _("%s: offset is greater than device size"), ctl->devname);
+       if (ctl->offset >= ctl->total_sectors)
+               errx(EXIT_FAILURE,
+                    _("%s: offset is greater than or equal to device size"), ctl->devname);
 
        zonesize = blkdev_chunk_sectors(ctl->devname);
        if (!zonesize)