From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756500AbcGHW1n (ORCPT ); Fri, 8 Jul 2016 18:27:43 -0400 Received: from mga01.intel.com ([192.55.52.88]:23777 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756307AbcGHW1h (ORCPT ); Fri, 8 Jul 2016 18:27:37 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,332,1464678000"; d="scan'208";a="991683186" Message-ID: <1468016848.9164.16.camel@linux.intel.com> Subject: Re: [PATCH -next] nvmet: fix return value check in nvmet_subsys_alloc() From: J Freyensee To: weiyj_lk@163.com, Christoph Hellwig , Sagi Grimberg Cc: Wei Yongjun , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org Date: Fri, 08 Jul 2016 15:27:28 -0700 In-Reply-To: <1467806529-23712-1-git-send-email-weiyj_lk@163.com> References: <1467806529-23712-1-git-send-email-weiyj_lk@163.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.16.5 (3.16.5-3.fc22) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2016-07-06 at 12:02 +0000, weiyj_lk@163.com wrote: > From: Wei Yongjun > > 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 Looks good and inline with how other drivers use kstrndup(), thanks for the fix. Reviewed-by: Jay Freyensee > --- > 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