Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5271530rwb; Mon, 21 Nov 2022 19:55:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf66qtHRqJovcr7+jFXaoGE4Rl2/Se0dpf4ZM7RkCoyf37lElqS+kXtV/KfsRfUknrMJ9yiJ X-Received: by 2002:a17:906:2342:b0:78d:9e77:1f8c with SMTP id m2-20020a170906234200b0078d9e771f8cmr9687150eja.236.1669089315941; Mon, 21 Nov 2022 19:55:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669089315; cv=none; d=google.com; s=arc-20160816; b=EgHQwfEuyHmc8kFBYzSyZyewcU/G7OrhyN25OTf0BDp3LI9jiTdDocxgDpQM+AUkne jo9aA4x0n/mPnsT/aCm5Iggqws3w7n+Ii+c31V2Vuw0DuU09bUrq12Bn2luvDKyAD/ez i6RiNz6EByBPhmerMQ1BM4Tr4w1jpHxqU1oFGMIzEjLHGLZVBfJ7zsk6WVH09H1zz/Jt T9ZjJ4I2U+LLOgiO17YvQzykHH/+0Ow8pYpraWpRYEcXwwdyNb8rcQ6Xq/JQf/u4AzMF YAk0cGoaQZAmNvpWnpPPOcatFaJEmYjabGagk7F/trsmqP5F6e7DV+2F7Eprsa9TFwhf UgRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=q3rtNB2ALn6ZgZkci91uIi9VkirFRavBNysHIEsFMf4=; b=J7Qm0tUw5s30LSrgjGU3uekRaSQno9AvC3HZwxSuMzhlMkUwvc8WyFas1r+BAg1iqC TT5fIkA7nHC9SBVk8VlP2lPezsJIiIpxA0m7uy7WNajkQrxljAdAUgBboUZfjUIhSGmg 2ugKe63auLdfRhZhqc45khg+AuWeltMBCGu0DTBlN/HKFFKtsgl2WgM49MDAqJlMoosV y6UWlZppFZdBdTFINJ92Su0CgHKdb1rh5aza+GAO7giWpV4IweWBjofS5dqWLSWdJTqb JCaXPOrHs9r4h1xrKSYYF9Bs3zypZ3de3dWBbZl5awcTr3iUoIk5iJbJK7EBUQFoyEDL dxgQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs31-20020a1709073e9f00b0078e27ef9501si10513243ejc.750.2022.11.21.19.54.50; Mon, 21 Nov 2022 19:55:15 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231717AbiKVDcy (ORCPT + 92 others); Mon, 21 Nov 2022 22:32:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229516AbiKVDcw (ORCPT ); Mon, 21 Nov 2022 22:32:52 -0500 Received: from cstnet.cn (smtp84.cstnet.cn [159.226.251.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 78B0A192AF for ; Mon, 21 Nov 2022 19:32:49 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.125]) by APP-05 (Coremail) with SMTP id zQCowAAXHu7dQnxj2HOwAA--.11930S2; Tue, 22 Nov 2022 11:32:45 +0800 (CST) From: Jiasheng Jiang To: jdmason@kudzu.us, dave.jiang@intel.com, allenbh@gmail.com, error27@gmail.com Cc: ntb@lists.linux.dev, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] NTB: ntb_tool: Add check for devm_kcalloc Date: Tue, 22 Nov 2022 11:32:44 +0800 Message-Id: <20221122033244.5777-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: zQCowAAXHu7dQnxj2HOwAA--.11930S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Jw4DurWfJryxGFy8CFW8tFb_yoWfZFc_CF y2qrsrGr45Cw45K3Z2yr4xZrWxA3WDuFZ7W3y8tan8urWDCw1xXry8urZxCa1fua48GFZr G34jyry0yF1xujkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbsxFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_ Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkF7I0En4kS14v26r1q 6r43MxkIecxEwVAFwVW8GwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8Jw C20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAF wI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjx v20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2 jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0x ZFpf9x0JUk5rxUUUUU= X-Originating-IP: [124.16.138.125] X-CM-SenderInfo: pmld2xxhqjqxpvfd2hldfou0/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS 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 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 --- 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; -- 2.25.1