Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5292202rwb; Mon, 21 Nov 2022 20:20:15 -0800 (PST) X-Google-Smtp-Source: AA0mqf7cIbcYRlRDnfd6Xfkv4pDlnbursTKrIsq5VVVfKGWOxA2S4XGn2Jvxcs6+xv/ei1r4OsYE X-Received: by 2002:a05:6402:b88:b0:469:32ba:44f6 with SMTP id cf8-20020a0564020b8800b0046932ba44f6mr5948902edb.427.1669090815395; Mon, 21 Nov 2022 20:20:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669090815; cv=none; d=google.com; s=arc-20160816; b=oxT/TVsYoTxyV01dgj3eYzmAKJERDIaEbLABquwJIPtEkrqQrDSEjfQN0eGbY/TI0U 9903gmjNL/POP0spyhoxAfzk2bkKihmktV1P2IKnJkqJfR3cYMYZ+TaTHgVvXbUY/SHo r/VhGkQapcrHp3ZzBNEMqqTaQGj2NrTVt4Z569brfFU7epLE5escphVqsrSuIB1x6+I4 MP/aV/youK3CHuQF8axRYB99m7k4o06irwaK7n933Dr7meHZCJK2KlPgPhJDB+g0T8/c w3wBxcjWmQEqcGYwqBEktzXAcczD/1hVJJoy9uV8y42qsGyOMpZjWLrpp6RPr3e+WX4z 3+pA== 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=cqnZCzlP9MWZ9mFWcxYcc5ohw47/3u2vYvCHjOVCGUinHa+eac/fneY7gX2z2cP/gw jJWWbVFhCbYL5dKIJ8CTk/xVjEJA1ENBi+hiYOPxcP4bdjFWUJ8X7zyoHRA23PvdFfKu IkmHwP7wY+zlB3GGPhvBeQSdNq2xytTVGIAJbuDNsvlRnf9oUieHQVCMJ7+hxn6KbC0U Dy3Uw1a9Kaycw3sw/pNmSgP22tomhhsY8ekEx2o18XDOD8VNjPbAnIs/YLMH/3HHP51+ 5CVP3bWPwDjts6UTOhJCyuhwomA/cm1azs1ado7J0I/7cVFnT5uAIdg4k9Et331ZO25J 79dw== 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 sd40-20020a1709076e2800b0077a19529760si11485679ejc.65.2022.11.21.20.19.53; Mon, 21 Nov 2022 20:20: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 S229639AbiKVDbP (ORCPT + 91 others); Mon, 21 Nov 2022 22:31:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231915AbiKVDbN (ORCPT ); Mon, 21 Nov 2022 22:31:13 -0500 Received: from cstnet.cn (smtp84.cstnet.cn [159.226.251.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 40D8326117 for ; Mon, 21 Nov 2022 19:31:11 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.125]) by APP-05 (Coremail) with SMTP id zQCowADX3+9lQnxjt1KwAA--.9972S2; Tue, 22 Nov 2022 11:30:46 +0800 (CST) From: Jiasheng Jiang To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, michal.simek@xilinx.com, harini.katakam@amd.com, xuhaoyue1@hisilicon.com, huangjunxian6@hisilicon.com, wangqing@vivo.com, christophe.jaillet@wanadoo.fr, yangyingliang@huawei.com, chenhao288@hisilicon.com Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] NTB: ntb_tool: Add check for devm_kcalloc Date: Tue, 22 Nov 2022 11:30:44 +0800 Message-Id: <20221122033044.5720-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: zQCowADX3+9lQnxjt1KwAA--.9972S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Jw4DurWfJryxGFy8CFW8tFb_yoWfZFc_CF y2qrsrGr45Cw45K3Z2yr4xZrWxA3WDuFZ7W3y8tan8urWDCw1xXry8urZxCa1fua48GFZr G34jyry0yF1xujkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUb4AFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_ Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxa n2IY04v7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrV AFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVW8ZVWrXwCI c40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267 AKxVW8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_ Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUbXdbU UUUUU== 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