summaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm
diff options
context:
space:
mode:
authorHeiner Litz <hlitz@ucsc.edu>2018-03-30 00:05:08 +0200
committerJens Axboe <axboe@kernel.dk>2018-03-30 01:29:09 +0200
commit9d7aa4a484872cb2b4dc81bd6f058cb8351ca9ed (patch)
treea8435f9c0da2a9b17379b27104db5446d5c91a2e /drivers/lightnvm
parentlightnvm: centralize permission check for lightnvm ioctl (diff)
downloadlinux-9d7aa4a484872cb2b4dc81bd6f058cb8351ca9ed.tar.xz
linux-9d7aa4a484872cb2b4dc81bd6f058cb8351ca9ed.zip
lightnvm: Avoid validation of default op value
Fixes: 38401d231de65 ("lightnvm: set target over-provision on create ioctl") Signed-off-by: Heiner Litz <hlitz@ucsc.edu> Reviewed-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <mb@lightnvm.io> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm')
-rw-r--r--drivers/lightnvm/core.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 5b197d6bb6d9..c4f12b1ae8b8 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -304,11 +304,9 @@ static int __nvm_config_extended(struct nvm_dev *dev,
}
/* op not set falls into target's default */
- if (e->op == 0xFFFF)
+ if (e->op == 0xFFFF) {
e->op = NVM_TARGET_DEFAULT_OP;
-
- if (e->op < NVM_TARGET_MIN_OP ||
- e->op > NVM_TARGET_MAX_OP) {
+ } else if (e->op < NVM_TARGET_MIN_OP || e->op > NVM_TARGET_MAX_OP) {
pr_err("nvm: invalid over provisioning value\n");
return -EINVAL;
}