Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp15214793rwb; Mon, 28 Nov 2022 09:06:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf7RmOAh7yr6j/OwPr97e69KCKOJezdbUj11Qz4ZMt5pNZI9YYaRc+qIDDzJ+X+Nvbw1Jjj+ X-Received: by 2002:a17:906:cf85:b0:78d:b66d:749f with SMTP id um5-20020a170906cf8500b0078db66d749fmr42249970ejb.566.1669655218860; Mon, 28 Nov 2022 09:06:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669655218; cv=none; d=google.com; s=arc-20160816; b=o9rfY4pWCARaHcuw4rx2sIhxrTDBRYzC3BcUMKSUU8QlDhTGC6/rgz/cndXE79wv45 hobh9wN9ng0DNNXBdN1+Fpev/rxhsx8tW3xz+ra1UcNIx9xPSFRu3yM53g57pBgD0+vC 5P/aE9cSfVpb1DZlNSjeX+yIbexauEw8kr0p2Raq5kvzzeKyZPvVe6QiBUpiPavxYxQg Knl7c4jRVrU9j2I+m1LXqIVv5uaQ9V0I/HvQmd7Ohl59bKwpm5vhxWREpLnOJSrhODxr ejzHkbSawcotZke2FGVJlNXfpp4s2uwL9W6tpIqBUPYZnhFtT5RZVUpfr/mTcb/F3vc2 czsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=t3m5Ru4jJLMHqG9TXfKBsgsve9s30t36u9lnUfdI/oU=; b=CI66rKdbJZdKfXaSnYmuXXBa6QjfWfNF5IhqPAnK36nApnYdKxjG0nD/zmd29Odvdp g8yv6OfV9CVK6Ix3lcumc1FDkLBnKjETdXGAFD8t+uB8qAgON5ud5VmT8nATaQ86rYwY oxzpaKqnWVwQ8B+7uwOYcYd5PvphzQzTM1kjCR7tCp7s0EPiSmHTqXTXje00MgzHWBHe rsJqJfx8c48fHAGV4fIq/RADyIm07lmcFO6ecEEIGUn+DadcNWLT3gYpTAhT/o3Cw6AY 6LnF8Ch5qThZDDX+EOG1n5MVE4Z+Lvzwf2ayeIz7D17UC1oBvUzyqEbl1y6jxAm6tsRT Uo4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dETZB6ra; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hv16-20020a17090760d000b00782e85ae302si11133309ejc.574.2022.11.28.09.06.33; Mon, 28 Nov 2022 09:06:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dETZB6ra; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231886AbiK1Pqu (ORCPT + 84 others); Mon, 28 Nov 2022 10:46:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231225AbiK1Pqs (ORCPT ); Mon, 28 Nov 2022 10:46:48 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 860401DA61 for ; Mon, 28 Nov 2022 07:46:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669650407; x=1701186407; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=gINwoiYDPzJelD3/jLSEqiZW+JXmK2TqiQoLLwLbUJU=; b=dETZB6raCp9OhPXTLQ3zV8dHW5f3YttVLsCpI571rlCuz33iMf4l+c49 DO/BfsXvsOS+ALZuLKUH5bq8PajSLik5m4XIYyARF3zto2thYMzRzAEC0 vIUF6x9Fu/W1wYPY6ioUHVkI6nPhuMu/exZlNJ5AxlX+wbfqU2MBJ7+oW gCCpzC7Vqr2vDWZFWGMw5vB5y+McPEgROoA004MwHyzwI14nTQYMsKtPS lorpryucxy0yZ0pxfw0fHg6aEybm75go5UuLw0bRBpDlmrwT13o5UTP+E d64uBZp/tINMpxqBLKbt768ja6+5MRBzMElDN1q0OK/o/Q6x/65I1x7fY Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10545"; a="294565905" X-IronPort-AV: E=Sophos;i="5.96,200,1665471600"; d="scan'208";a="294565905" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2022 07:37:30 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10545"; a="785672819" X-IronPort-AV: E=Sophos;i="5.96,200,1665471600"; d="scan'208";a="785672819" Received: from djiang5-mobl2.amr.corp.intel.com (HELO [10.209.161.118]) ([10.209.161.118]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2022 07:37:29 -0800 Message-ID: Date: Mon, 28 Nov 2022 08:37:29 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.5.0 Subject: Re: [PATCH] NTB: ntb_tool: Add check for devm_kcalloc Content-Language: en-US To: Jiasheng Jiang , jdmason@kudzu.us, allenbh@gmail.com, error27@gmail.com Cc: ntb@lists.linux.dev, linux-kernel@vger.kernel.org References: <20221122033244.5777-1-jiasheng@iscas.ac.cn> From: Dave Jiang In-Reply-To: <20221122033244.5777-1-jiasheng@iscas.ac.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/21/2022 8:32 PM, Jiasheng Jiang wrote: > As the devm_kcalloc may return NULL pointer, > it should be better to add check for the return > value, as same as the others. > > Fixes: 7f46c8b3a552 ("NTB: ntb_tool: Add full multi-port NTB API support") > Signed-off-by: Jiasheng Jiang Reviewed-by: Dave Jiang > --- > drivers/ntb/test/ntb_tool.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/ntb/test/ntb_tool.c b/drivers/ntb/test/ntb_tool.c > index 5ee0afa621a9..eeeb4b1c97d2 100644 > --- a/drivers/ntb/test/ntb_tool.c > +++ b/drivers/ntb/test/ntb_tool.c > @@ -998,6 +998,8 @@ static int tool_init_mws(struct tool_ctx *tc) > tc->peers[pidx].outmws = > devm_kcalloc(&tc->ntb->dev, tc->peers[pidx].outmw_cnt, > sizeof(*tc->peers[pidx].outmws), GFP_KERNEL); > + if (tc->peers[pidx].outmws == NULL) > + return -ENOMEM; > > for (widx = 0; widx < tc->peers[pidx].outmw_cnt; widx++) { > tc->peers[pidx].outmws[widx].pidx = pidx;