Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1437669 > unrolled thread
| Started by | weiyj_lk@163.com |
|---|---|
| First post | 2016-07-06 14:10 +0200 |
| Last post | 2016-07-09 00:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc() weiyj_lk@163.com - 2016-07-06 14:10 +0200
Re: [PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc() J Freyensee <james_p_freyensee@linux.intel.com> - 2016-07-09 00:30 +0200
| From | weiyj_lk@163.com |
|---|---|
| Date | 2016-07-06 14:10 +0200 |
| Subject | [PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc() |
| Message-ID | <rRTOq-Bq-27@gated-at.bofh.it> |
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;
}
[toc] | [next] | [standalone]
| From | J Freyensee <james_p_freyensee@linux.intel.com> |
|---|---|
| Date | 2016-07-09 00:30 +0200 |
| Subject | Re: [PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc() |
| Message-ID | <rSMrw-2wN-13@gated-at.bofh.it> |
| In reply to | #1437669 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web