linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: james_p_freyensee@linux.intel.com (J Freyensee)
Subject: [PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc()
Date: Fri, 08 Jul 2016 15:27:28 -0700	[thread overview]
Message-ID: <1468016848.9164.16.camel@linux.intel.com> (raw)
In-Reply-To: <1467806529-23712-1-git-send-email-weiyj_lk@163.com>

On Wed, 2016-07-06@12:02 +0000, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei at 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 at trendmicro.com.cn>

Looks good and inline with how other drivers use kstrndup(), thanks for
the fix.

Reviewed-by: Jay Freyensee <james_p_freyensee at 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 at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2016-07-08 22:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-07-12 15:34 ` Jens Axboe
2016-07-13 10:37 ` Sagi Grimberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1468016848.9164.16.camel@linux.intel.com \
    --to=james_p_freyensee@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).