From patchwork Tue Nov 22 05:54:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 24159 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2024775wrr; Mon, 21 Nov 2022 21:57:19 -0800 (PST) X-Google-Smtp-Source: AA0mqf4D+balWtIw4Cc4WBFURtVkXl/spbXCms71O0ZnjyZf2OqYeV+TH7bLgZTgdmF+xvpCtUkn X-Received: by 2002:a17:906:5a8b:b0:7a5:f8a5:6f80 with SMTP id l11-20020a1709065a8b00b007a5f8a56f80mr19167816ejq.202.1669096639661; Mon, 21 Nov 2022 21:57:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669096639; cv=none; d=google.com; s=arc-20160816; b=wE/2RFhvTIJ/1fCqJOgFxNlzMRUVP76VHfeSdE8k7usA9oilfZwdAUtTKBxgKaP6Kj xtK3sBvGs3IqLavRIC1C5nlhi4LjoW5TclIFs+c5lg+YhuHMZLZseqYywauEsjdsecmg 8eezbomUtvQBMmxAFR+WtYcPLbk9TKy0NehKq8L2A2D4vjbwJnFZsTs4UIIuMOe6FoLI 6j60ethGUM9WMAjm7p7s+OGufRzsGx+9g0k3fJ2sLddFoN3C25VA4WYObokzyWtvJkA3 Zo+hcHYYMWScncTXiu5mBUa7+OE42pJ41UyRWUPwlE0fuDwJekFTVQHug5qo8VfoTh3t /QHA== 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=1djOaN1naVtI09Gw6dcmcJvskaaXu8xnTBgxDlifO6k=; b=Qie6gmK0LQTRGvZ6YTEswhTsM8YOiGHCkH0/u6ZczfVuQs2+WzRmYlkqwRuqDWlz1o B+2BXk+YLzZlHS8rjZ7Mki4xnUcQFD+3LXbZ4ilk+UhzWZeRHnTgTxYwb3MubE4MPdbf q5qg1uLhhZ2N5+cLyy4hO0/U4JcfxdzknQtEMl1mVnWvUehkfBSL3d30MxeTMnXH1Fdo 7lBgqFqHZNabCFLX/MA/SNKjiZI/iI5+N1z4AzGz5hxBaj+/00T/P306PakFrL9/New8 FSoJF+1owIsTsIH/PgDeDKozl+V3JaS2ydFaLcqCc7PjIVqXM08MQFLVFJ2piNK3o7S2 v5vQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y18-20020a056402359200b00462e23be64fsi11716331edc.578.2022.11.21.21.56.56; Mon, 21 Nov 2022 21:57:19 -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 S231825AbiKVFzW (ORCPT + 99 others); Tue, 22 Nov 2022 00:55:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231490AbiKVFzN (ORCPT ); Tue, 22 Nov 2022 00:55:13 -0500 Received: from cstnet.cn (smtp84.cstnet.cn [159.226.251.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3C28026550; Mon, 21 Nov 2022 21:55:11 -0800 (PST) Received: from localhost.localdomain (unknown [124.16.138.125]) by APP-05 (Coremail) with SMTP id zQCowABXX+80ZHxjfQm9AA--.28359S2; Tue, 22 Nov 2022 13:55:00 +0800 (CST) From: Jiasheng Jiang To: sgoutham@marvell.com, lcherian@marvell.com, gakula@marvell.com, jerinj@marvell.com, hkelam@marvell.com, sbhatta@marvell.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH] octeontx2-pf: Add check for devm_kcalloc Date: Tue, 22 Nov 2022 13:54:49 +0800 Message-Id: <20221122055449.31247-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: zQCowABXX+80ZHxjfQm9AA--.28359S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Jw4kWFWfur13Ar1UXF1rXrb_yoWDGFgEkF sF9F17Aw4YkrySy3WjyrW3ury0kF1kXr4vqr43KrWaqaykGw4fC34kurZ3Jr48W3yIqF1D ArnFkry7Aw1UGjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbV8FF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8w A2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr0_ Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r1Y6r17McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxa n2IY04v7MxkIecxEwVAFwVW8WwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJV W8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF 1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6x IIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvE x4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvj DU0xZFpf9x0JU6mhwUUUUU= 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750174677871482762?= X-GMAIL-MSGID: =?utf-8?q?1750174677871482762?= 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: e8e095b3b370 ("octeontx2-af: cn10k: Bandwidth profiles config support") Signed-off-by: Jiasheng Jiang Reviewed-by: Maciej Fijalkowski --- drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c index 7646bb2ec89b..a62c1b322012 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_nix.c @@ -4985,6 +4985,8 @@ static int nix_setup_ipolicers(struct rvu *rvu, ipolicer->ref_count = devm_kcalloc(rvu->dev, ipolicer->band_prof.max, sizeof(u16), GFP_KERNEL); + if (!ipolicer->ref_count) + return -ENOMEM; } /* Set policer timeunit to 2us ie (19 + 1) * 100 nsec = 2us */