[PATCH] blkzone: fix report zones sector offset check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
---
 sys-utils/blkzone.c | 5 +++--
 1 file 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)
-- 
2.14.4




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux