From: Wei Yongjun Date: Wed, 6 Jul 2016 12:02:09 +0000 (+0000) Subject: nvmet: fix return value check in nvmet_subsys_alloc() X-Git-Tag: v4.8-rc1~161^2~19 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=69555af2ce32a31d11666e5fe20628b35fdf7ef3;p=linux.git 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 Reviewed-by: Jay Freyensee Signed-off-by: Jens Axboe --- 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; }