[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1f1c21cf-c34c-418c-b00c-8e6474f12612@web.de>
Date: Sat, 23 Dec 2023 20:20:23 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linuxppc-dev@...ts.ozlabs.org, kernel-janitors@...r.kernel.org,
"Aneesh Kumar K.V" <aneesh.kumar@...nel.org>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Michael Ellerman <mpe@...erman.id.au>,
"Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
Nicholas Piggin <npiggin@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr
Subject: [PATCH 1/2] powerpc/powernv/vas: One function call less in
vas_window_alloc() after error detection
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 23 Dec 2023 19:35:13 +0100
The kfree() function was called in one case by the
vas_window_alloc() function during error handling
even if the passed variable contained a null pointer.
This issue was detected by using the Coccinelle software.
Thus use another label.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
arch/powerpc/platforms/powernv/vas-window.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/vas-window.c b/arch/powerpc/platforms/powernv/vas-window.c
index b664838008c1..b51219b4b698 100644
--- a/arch/powerpc/platforms/powernv/vas-window.c
+++ b/arch/powerpc/platforms/powernv/vas-window.c
@@ -545,7 +545,7 @@ static struct pnv_vas_window *vas_window_alloc(struct vas_instance *vinst)
window = kzalloc(sizeof(*window), GFP_KERNEL);
if (!window)
- goto out_free;
+ goto release_window_id;
window->vinst = vinst;
window->vas_win.winid = winid;
@@ -559,6 +559,7 @@ static struct pnv_vas_window *vas_window_alloc(struct vas_instance *vinst)
out_free:
kfree(window);
+release_window_id:
vas_release_window_id(&vinst->ida, winid);
return ERR_PTR(-ENOMEM);
}
--
2.43.0
Powered by blists - more mailing lists