From: "Matias Bjørling" <matias@cnexlabs.com>
To: <axboe@fb.com>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
"Matias Bjørling" <matias@cnexlabs.com>
Subject: [PATCH 1/2] lightnvm: fix off-by-one error on target initialization
Date: Wed, 15 Feb 2017 16:25:32 +0100 [thread overview]
Message-ID: <20170215152533.9712-2-matias@cnexlabs.com> (raw)
In-Reply-To: <20170215152533.9712-1-matias@cnexlabs.com>
If one specifies the end lun id to be the absolute number of luns,
without taking zero indexing into account, the lightnvm core will pass
the off-by-one end lun id to target creation, which then panics during
nvm_ioctl_dev_create.
Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
---
drivers/lightnvm/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 9bfe035..6ce76c0 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -1102,9 +1102,9 @@ static int __nvm_configure_create(struct nvm_ioctl_create *create)
}
s = &create->conf.s;
- if (s->lun_begin > s->lun_end || s->lun_end > dev->geo.nr_luns) {
+ if (s->lun_begin > s->lun_end || s->lun_end >= dev->geo.nr_luns) {
pr_err("nvm: lun out of bound (%u:%u > %u)\n",
- s->lun_begin, s->lun_end, dev->geo.nr_luns);
+ s->lun_begin, s->lun_end, dev->geo.nr_luns - 1);
return -EINVAL;
}
--
2.9.3
next prev parent reply other threads:[~2017-02-15 15:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-15 15:25 [PATCH 0/2] Small fixes for LightNVM core Matias Bjørling
2017-02-15 15:25 ` Matias Bjørling [this message]
2017-02-15 15:25 ` [PATCH 2/2] lightnvm: set default lun range when no luns are specified Matias Bjørling
2017-02-15 15:27 ` [PATCH 0/2] Small fixes for LightNVM core Jens Axboe
2017-02-15 15:28 ` Matias Bjørling
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=20170215152533.9712-2-matias@cnexlabs.com \
--to=matias@cnexlabs.com \
--cc=axboe@fb.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®