Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1725426rwl; Wed, 5 Apr 2023 23:36:39 -0700 (PDT) X-Google-Smtp-Source: AKy350bMx3P7rQbD5WVXRPPSet/azxLh5FCxTQUfzT/EHzJGIsezH7GDE0Y/EIQZvvrXREJqUaP2 X-Received: by 2002:a17:902:e292:b0:1a2:1a33:6feb with SMTP id o18-20020a170902e29200b001a21a336febmr7689202plc.34.1680762999643; Wed, 05 Apr 2023 23:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680762999; cv=none; d=google.com; s=arc-20160816; b=ZMAqrC1Gmh9S9/fs7yumgEHWsvtVKmd4ooRBeeWuIo/Eb+sQezxB2DYol1Y0+umJVJ Ue1KipMQV7PDtrb7Jt1qTvyUu+auEm2sfV3lRwN22xdGf+Hp5gTHaYlCnMRIZqLuzxLh ocM1L1FneVWLVk6yKli5xMrAq0ENfjrdJXKfh6a56QLhM8AwikYYZv7XGzMP+D2+0RX/ mu0oW9nIyeG0Pu6+NbUnqf2yY807FNl6YkaU+ywAs4g6v9QIVhEK6E/tLrihcTwKJY6K GtkrfAZo08E7l5ZMVW4YtZOt8ituZ6ptNWyq9qvreyDzPItVgKX7EdFkaBCbe6UbCpqy yjTA== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g5-20020a63dd45000000b0050f7dc442c1si497401pgj.759.2023.04.05.23.36.27; Wed, 05 Apr 2023 23:36:39 -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 S235419AbjDFGc6 (ORCPT + 99 others); Thu, 6 Apr 2023 02:32:58 -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 Content-Transfer-Encoding: 8bit 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 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 --- 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), -- 2.38.1