diff options
author | Masato Suzuki | 2018-10-23 11:31:35 +0200 |
---|---|---|
committer | Karel Zak | 2018-10-23 11:49:41 +0200 |
commit | 8a7f4b5bfe35ffc5f32cea67335d8265f77a4697 (patch) | |
tree | 23a83ce530815c00bf3c69e27eff8224feff6795 /sys-utils/blkzone.c | |
parent | agetty: don't put the VC into canonical mode (diff) | |
download | kernel-qcow2-util-linux-8a7f4b5bfe35ffc5f32cea67335d8265f77a4697.tar.gz kernel-qcow2-util-linux-8a7f4b5bfe35ffc5f32cea67335d8265f77a4697.tar.xz kernel-qcow2-util-linux-8a7f4b5bfe35ffc5f32cea67335d8265f77a4697.zip |
blkzone: fix report zones sector offset check
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>
Diffstat (limited to 'sys-utils/blkzone.c')
-rw-r--r-- | sys-utils/blkzone.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sys-utils/blkzone.c b/sys-utils/blkzone.c index b6a3aa46c..1dcbdf500 100644 --- a/sys-utils/blkzone.c +++ b/sys-utils/blkzone.c @@ -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) |