summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>2016-07-06 14:02:09 +0200
committerJens Axboe <axboe@fb.com>2016-07-12 17:33:43 +0200
commit69555af2ce32a31d11666e5fe20628b35fdf7ef3 (patch)
treebf8f78689a6ab8ec0c4c064a2ebbcc65bccb1a89
parentnvme-fabrics: add-remove ctrl repeat fix (diff)
downloadlinux-69555af2ce32a31d11666e5fe20628b35fdf7ef3.tar.xz
linux-69555af2ce32a31d11666e5fe20628b35fdf7ef3.zip
nvmet: fix return value check in nvmet_subsys_alloc()
In case of error, the function kstrndup() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Reviewed-by: Jay Freyensee <james_p_freyensee@linux.intel.com> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--drivers/nvme/target/core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index e0b3f0166722..8a891ca53367 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -895,7 +895,7 @@ struct nvmet_subsys *nvmet_subsys_alloc(const char *subsysnqn,
subsys->type = type;
subsys->subsysnqn = kstrndup(subsysnqn, NVMF_NQN_SIZE,
GFP_KERNEL);
- if (IS_ERR(subsys->subsysnqn)) {
+ if (!subsys->subsysnqn) {
kfree(subsys);
return NULL;
}