mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 01/12] firmware: xilinx-fpga: fix double free in probe error path
@ 2026-02-16  8:42 Ahmad Fatoum
  2026-02-16  8:42 ` [PATCH 02/12] driver: fix missing va_end in dev_add_alias " Ahmad Fatoum
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Ahmad Fatoum @ 2026-02-16  8:42 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum, Claude Opus 4.6

When firmwaremgr_register() fails, free(mgr) is called before jumping
to out_unreg. But the out: label (which out_unreg falls through to)
also calls free(mgr), resulting in a double free.

Remove the redundant free(mgr) before the goto, since the cleanup
labels already handle it.

Fixes: 2f4a47ef53 ("Added support for Zynq 7000 FPGA firmware loading")
Reported-by: GCC 14.2 -fanalyzer
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/firmware/xilinx-fpga.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/firmware/xilinx-fpga.c b/drivers/firmware/xilinx-fpga.c
index 18d4e62ed1c3..7822521ef982 100644
--- a/drivers/firmware/xilinx-fpga.c
+++ b/drivers/firmware/xilinx-fpga.c
@@ -334,10 +334,8 @@ static int xilinx_fpga_probe(struct device *dev)
 	fh->device_node = dev->of_node;
 
 	ret = firmwaremgr_register(fh);
-	if (ret != 0) {
-		free(mgr);
+	if (ret != 0)
 		goto out_unreg;
-	}
 
 	return 0;
 out_unreg:
-- 
2.47.3




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-02-16  8:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-16  8:42 [PATCH 01/12] firmware: xilinx-fpga: fix double free in probe error path Ahmad Fatoum
2026-02-16  8:42 ` [PATCH 02/12] driver: fix missing va_end in dev_add_alias " Ahmad Fatoum
2026-02-16  8:42 ` [PATCH 03/12] net: eth: avoid overlapping memcpy in eth_set_ethaddr Ahmad Fatoum
2026-02-16  8:42 ` [PATCH 04/12] pmdomain: fix dereference before NULL check in genpd_get_from_provider Ahmad Fatoum
2026-02-16  8:42 ` [PATCH 05/12] bootm: android: fix PTR_ERR called after clearing error pointer Ahmad Fatoum
2026-02-16  8:42 ` [PATCH 06/12] bootm: android: fix double close of fd Ahmad Fatoum
2026-02-16  8:42 ` [PATCH 07/12] net: phy: add NULL check for phy driver in page accessors Ahmad Fatoum
2026-02-16  8:42 ` [PATCH 08/12] open: add missing mode argument to O_CREAT calls Ahmad Fatoum
2026-02-16  8:42 ` [PATCH 09/12] hush: add NULL check for gl_pathv after do_glob_in_argv Ahmad Fatoum
2026-02-16  8:42 ` [PATCH 10/12] i2c: rk3x: fix NULL pointer dereference on repeated NACK Ahmad Fatoum
2026-02-16  8:42 ` [PATCH 11/12] mci: imx-esdhc: remove misleading NULL check for cmd pointer Ahmad Fatoum
2026-02-16  8:42 ` [PATCH 12/12] mci: spi: initialize r1 to fix garbage return value Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox