From patchwork Thu Apr 6 06:31:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harshit Mogalapalli X-Patchwork-Id: 80075 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp819904vqo; Wed, 5 Apr 2023 23:49:42 -0700 (PDT) X-Google-Smtp-Source: AKy350ZDTxuxX5CJbRyI9gnbA4kZ77i1oNGslj2IYNTPgPH1VkfCDLJvSXCSHP02tcKlTiR1dJYi X-Received: by 2002:a17:907:76c6:b0:91f:c7e:22ba with SMTP id kf6-20020a17090776c600b0091f0c7e22bamr5694175ejc.27.1680763782099; Wed, 05 Apr 2023 23:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680763782; cv=none; d=google.com; s=arc-20160816; b=03VmPGAbtL05iTIoUl0K95u977FXZpMJdeMnyFktgiVEndfnEtlTNgjIvLlOmq7whL p3fysKKVv0MXb0u05PkpX8URidKrGnJfxD/13+4Bv4Ptc/pEGMYr6bQtx9uveItytae8 klnbjDuIJnytgsnZ5FnKBoYFIIcmI3MO4uNus7RZVLNBooI6G4vXkFxUsQkvYnjK8tDy 5TOdSKSdPnPFUF0tpbDepAH/vlnvK8VSYpjqEQ7FLOY5wbtmJfob/1cnrKQLpEpDmwoM YlbOhhfI8+vbOjos0Ee64EQhURSZlxhS97jGVP6OYIS8DRGvyhLvZ7foGY35Cn5G8gBk ph4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature; bh=W8fuFynOzEkF9xzS/VbiRUIeSynChenJ3AB3QoB4N/g=; b=sPdoBx4BMeHaCSGD0r981UTR4yzVJtIEu09y5+jNA474AtF7gN4LtecZjDCrJz3Oue DsnrIzpy9dNK7XcxyawYq8gbNbLFu6PuOtVemjTEpPh/IveE49zbrILwskpQHUu/5QB/ AVy75Ja5KVCkd0SvM8IF4jj5/0DPCx1IlMN4m60Hhl7OOfa+EaWrlxQQtTpB3faIF7Ot HcX7xTlwc+Ef/7cxvH7n6L/NUC8cFnGQhCxoNiT5ciFkJMXxFHtAHTdwlf+3/KpsMr/B Su6gks5j92VBnpHh4ooUkfPkDv2eSUMnbUkF58IY25XqmXAvQM29e+5Lk8lQnK300WWd GYkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@oracle.com header.s=corp-2022-7-12 header.b=WQphwdhh; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sz14-20020a1709078b0e00b00949cba063a5si419040ejc.970.2023.04.05.23.49.15; Wed, 05 Apr 2023 23:49:42 -0700 (PDT) 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=fail header.i=@oracle.com header.s=corp-2022-7-12 header.b=WQphwdhh; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235422AbjDFGc7 (ORCPT + 99 others); Thu, 6 Apr 2023 02:32:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232896AbjDFGc5 (ORCPT ); Thu, 6 Apr 2023 02:32:57 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FCB81712; Wed, 5 Apr 2023 23:32:56 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 335JJWx1008158; Thu, 6 Apr 2023 06:32:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2022-7-12; bh=W8fuFynOzEkF9xzS/VbiRUIeSynChenJ3AB3QoB4N/g=; b=WQphwdhhXEED5qe77ZO/7SUMTPoHKAIdN8UwY61lB+Gjk0waR7GH3DoGScEEOUIM6uBG dPAi72iyRMmvw/iXmzBxirZNLlO4rY8w1MYef0RSBxuiu/DhMWljx9YszyhGpxDaC2Ci 9DHUypxrK32bd4TuRl5Rjxq3Sky+rrUuqlQeOVyKasmmjiZl8zjFUrUVmqhHVVaSC0wO go5e1HDKbyXwLtxO6LdVOOQTMa0s1+ECDUJ4bnkUGcVsIEERVRhxRVk4odPqPkwSW7Nq zOS/fiG+PyDa2tZIYxt/tsGtcqi7NC4vMnw9/3QvG6MF6iwHO9kwpmh099cAKmFo7NHh uw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3ppc7u2276-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Apr 2023 06:32:38 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 3366DYGG013990; Thu, 6 Apr 2023 06:32:37 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3ppt3jfjee-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Apr 2023 06:32:37 +0000 Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3366Sw9q021327; Thu, 6 Apr 2023 06:32:36 GMT Received: from ca-dev112.us.oracle.com (ca-dev112.us.oracle.com [10.129.136.47]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 3ppt3jfjdf-1; Thu, 06 Apr 2023 06:32:36 +0000 From: Harshit Mogalapalli Cc: error27@gmail.com, kernel-janitors@vger.kernel.org, Harshit Mogalapalli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Marc Kleine-Budde , Leon Romanovsky , Kees Cook , Rob Herring , Wolfram Sang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] niu: Fix missing unwind goto in niu_alloc_channels() Date: Wed, 5 Apr 2023 23:31:18 -0700 Message-Id: <20230406063120.3626731-1-harshit.m.mogalapalli@oracle.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-06_02,2023-04-05_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 adultscore=0 suspectscore=0 spamscore=0 malwarescore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304060056 X-Proofpoint-ORIG-GUID: wRQ8roJm4lBKfJBBFkGUyi5oUtON5QFe X-Proofpoint-GUID: wRQ8roJm4lBKfJBBFkGUyi5oUtON5QFe X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) 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?1762408563206582038?= X-GMAIL-MSGID: =?utf-8?q?1762408563206582038?= Smatch reports: drivers/net/ethernet/sun/niu.c:4525 niu_alloc_channels() warn: missing unwind goto? If niu_rbr_fill() fails, then we are directly returning 'err' without freeing the channels. Fix this by changing direct return to a goto 'out_err'. Fixes: a3138df9f20e ("[NIU]: Add Sun Neptune ethernet driver.") Signed-off-by: Harshit Mogalapalli Reviewed-by: Simon Horman --- This is purely based on static analysis. Only compile tested. --- drivers/net/ethernet/sun/niu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index ab8b09a9ef61..7a2e76776297 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c @@ -4522,7 +4522,7 @@ static int niu_alloc_channels(struct niu *np) err = niu_rbr_fill(np, rp, GFP_KERNEL); if (err) - return err; + goto out_err; } tx_rings = kcalloc(num_tx_rings, sizeof(struct tx_ring_info),