From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 713BE2566 for ; Tue, 18 Apr 2023 12:27:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EACB0C433EF; Tue, 18 Apr 2023 12:27:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1681820849; bh=6glXxktjhgbfeKr8HepW+kTHpI6W7emB7q42xPkjxQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rZsagqw1Xj7roZrymIRMqcYvVkIllTKPJhbQ1OXx6iWxATw0EiwZ9CBBqN9fEG9z/ sLYrxDOYwEO1I0/jQovRcnTmawwwbyodCJyMrVxm3+pfKl44X6azbiknByRr3s/MWH 844CTCnics/SdSv+0YaR9HsNdLWPDdwICSvSW6JU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Harshit Mogalapalli , Simon Horman , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 37/57] niu: Fix missing unwind goto in niu_alloc_channels() Date: Tue, 18 Apr 2023 14:21:37 +0200 Message-Id: <20230418120300.038742824@linuxfoundation.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230418120258.713853188@linuxfoundation.org> References: <20230418120258.713853188@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Harshit Mogalapalli [ Upstream commit 8ce07be703456acb00e83d99f3b8036252c33b02 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 605c4d15b88c1..1693a70325c50 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c @@ -4505,7 +4505,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.39.2