From: Masato Suzuki <masato.suzuki@wdc.com>
To: util-linux@vger.kernel.org
Cc: Damien.LeMoal@wdc.com
Subject: [PATCH] blkzone: fix report zones sector offset check
Date: Tue, 23 Oct 2018 18:31:35 +0900 [thread overview]
Message-ID: <20181023093135.13414-1-masato.suzuki@wdc.com> (raw)
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
next reply other threads:[~2018-10-23 9:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-23 9:31 Masato Suzuki [this message]
2018-10-23 9:50 ` [PATCH] blkzone: fix report zones sector offset check Karel Zak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181023093135.13414-1-masato.suzuki@wdc.com \
--to=masato.suzuki@wdc.com \
--cc=Damien.LeMoal@wdc.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).