mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] environment: fix free() of unitialized variable
@ 2025-02-05  9:48 Sascha Hauer
  2025-02-17 11:10 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2025-02-05  9:48 UTC (permalink / raw)
  To: Barebox List

of_find_path() doesn't initialize the outpath on error. In order to
free() it in the error path we have to initialize devpath.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/barebox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/barebox.c b/drivers/of/barebox.c
index 9b8da679e2..e6bcff7116 100644
--- a/drivers/of/barebox.c
+++ b/drivers/of/barebox.c
@@ -34,7 +34,7 @@ static char *environment_probe_1node_binding(struct device *dev)
 static char *environment_probe_2node_binding(struct device *dev)
 {
 	const char *filepath;
-	char *devpath;
+	char *devpath = NULL;
 	int ret;
 
 	ret = of_find_path(dev->of_node, "device-path", &devpath,
-- 
2.39.5




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

* Re: [PATCH] environment: fix free() of unitialized variable
  2025-02-05  9:48 [PATCH] environment: fix free() of unitialized variable Sascha Hauer
@ 2025-02-17 11:10 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-02-17 11:10 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer


On Wed, 05 Feb 2025 10:48:32 +0100, Sascha Hauer wrote:
> of_find_path() doesn't initialize the outpath on error. In order to
> free() it in the error path we have to initialize devpath.
> 
> 

Applied, thanks!

[1/1] environment: fix free() of unitialized variable
      https://git.pengutronix.de/cgit/barebox/commit/?id=7221acb2f030 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2025-02-17 12:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-05  9:48 [PATCH] environment: fix free() of unitialized variable Sascha Hauer
2025-02-17 11:10 ` Sascha Hauer

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