* [PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc()
@ 2016-07-06 12:02 weiyj_lk
2016-07-08 22:27 ` J Freyensee
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: weiyj_lk @ 2016-07-06 12:02 UTC (permalink / raw)
To: Christoph Hellwig, Sagi Grimberg; +Cc: Wei Yongjun, linux-nvme, linux-kernel
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
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>
---
drivers/nvme/target/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index e0b3f01..8a891ca 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;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc()
2016-07-06 12:02 [PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc() weiyj_lk
@ 2016-07-08 22:27 ` J Freyensee
2016-07-12 15:34 ` Jens Axboe
2016-07-13 10:37 ` Sagi Grimberg
2 siblings, 0 replies; 4+ messages in thread
From: J Freyensee @ 2016-07-08 22:27 UTC (permalink / raw)
To: weiyj_lk, Christoph Hellwig, Sagi Grimberg
Cc: Wei Yongjun, linux-kernel, linux-nvme
On Wed, 2016-07-06 at 12:02 +0000, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> 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>
Looks good and inline with how other drivers use kstrndup(), thanks for
the fix.
Reviewed-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
> ---
> drivers/nvme/target/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
> index e0b3f01..8a891ca 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;
> }
>
>
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc()
2016-07-06 12:02 [PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc() weiyj_lk
2016-07-08 22:27 ` J Freyensee
@ 2016-07-12 15:34 ` Jens Axboe
2016-07-13 10:37 ` Sagi Grimberg
2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2016-07-12 15:34 UTC (permalink / raw)
To: weiyj_lk, Christoph Hellwig, Sagi Grimberg
Cc: Wei Yongjun, linux-kernel, linux-nvme
On 07/06/2016 05:02 AM, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> 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.
Added for 4.8, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc()
2016-07-06 12:02 [PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc() weiyj_lk
2016-07-08 22:27 ` J Freyensee
2016-07-12 15:34 ` Jens Axboe
@ 2016-07-13 10:37 ` Sagi Grimberg
2 siblings, 0 replies; 4+ messages in thread
From: Sagi Grimberg @ 2016-07-13 10:37 UTC (permalink / raw)
To: weiyj_lk, Christoph Hellwig; +Cc: Wei Yongjun, linux-nvme, linux-kernel
Thanks,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-13 10:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-06 12:02 [PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc() weiyj_lk
2016-07-08 22:27 ` J Freyensee
2016-07-12 15:34 ` Jens Axboe
2016-07-13 10:37 ` Sagi Grimberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).