mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: i.MX: phytec-som-imx6: use strdup instead of basprintf
@ 2024-02-20 12:20 Ahmad Fatoum
  2024-02-23  7:32 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2024-02-20 12:20 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

Using basprintf to duplicate a string violates memory safety if
default_environment_path were to contain a format specifier.

clangd warns about this, so fix this by using strdup instead.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/phytec-som-imx6/board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boards/phytec-som-imx6/board.c b/arch/arm/boards/phytec-som-imx6/board.c
index bff95221abf3..2db3fa1db8cd 100644
--- a/arch/arm/boards/phytec-som-imx6/board.c
+++ b/arch/arm/boards/phytec-som-imx6/board.c
@@ -231,7 +231,7 @@ static int physom_imx6_probe(struct device *dev)
 		envdev = "SPI NOR flash";
 		break;
 	default:
-		environment_path = basprintf(default_environment_path);
+		environment_path = strdup(default_environment_path);
 		envdev = default_envdev;
 		break;
 	}
-- 
2.39.2




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

end of thread, other threads:[~2024-02-23  7:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 12:20 [PATCH] ARM: i.MX: phytec-som-imx6: use strdup instead of basprintf Ahmad Fatoum
2024-02-23  7:32 ` Sascha Hauer

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