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>
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)