Przeglądaj źródła

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>
Wei Yongjun 9 lat temu
rodzic
commit
69555af2ce
1 zmienionych plików z 1 dodań i 1 usunięć
  1. 1 1
      drivers/nvme/target/core.c

+ 1 - 1
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;
 	}