From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxx> --- 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