[PATCH] ARM: i.MX: phytec-som-imx6: use strdup instead of basprintf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux