Util-Linux Archive on lore.kernel.org
 help / Atom feed
* [PATCH] blkzone: fix report zones sector offset check
@ 2018-10-23  9:31 Masato Suzuki
  2018-10-23  9:50 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Masato Suzuki @ 2018-10-23  9:31 UTC (permalink / raw)
  To: util-linux; +Cc: Damien.LeMoal

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] blkzone: fix report zones sector offset check
  2018-10-23  9:31 [PATCH] blkzone: fix report zones sector offset check Masato Suzuki
@ 2018-10-23  9:50 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2018-10-23  9:50 UTC (permalink / raw)
  To: Masato Suzuki; +Cc: util-linux, Damien.LeMoal

On Tue, Oct 23, 2018 at 06:31:35PM +0900, Masato Suzuki wrote:
>  sys-utils/blkzone.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-23  9:31 [PATCH] blkzone: fix report zones sector offset check Masato Suzuki
2018-10-23  9:50 ` Karel Zak

Util-Linux Archive on lore.kernel.org

Archives are clonable: git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \
		util-linux@vger.kernel.org util-linux@archiver.kernel.org
	public-inbox-index util-linux


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.util-linux


AGPL code for this site: git clone https://public-inbox.org/ public-inbox