Skip to contentSkip to conversation

fsl-layerscape/soc.c: do not destroy bootcmd environment

PATCH In review Mike Looijmans 2 participants 2 messages Jan 30, 2024 1 message not in the archive Arm (32-bit)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1b153bce-a66a-45ee-a5c6-963ea6fb1c82.949ef384-8293-46b8-903f-40a477c056ae.3f58dbb3-6e3c-43d9-9553-fe60808a43a3@emailsignatures365.codetwo.com

#1 lore raw

PATCH 1/1 fsl-layerscape/soc.c: do not destroy bootcmd environment

When an XXX_BOOTCOMMAND isn't defined, the result is that bootcmd is set to some random memory content. Fix it so that the function does nothing in that case and leaves the bootcmd environment unmodified.

---

 arch/arm/cpu/armv8/fsl-layerscape/soc.c | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/cpu/armv8/fsl-layerscape/soc.c +5 -0
index 3bfdc3f774..4c61d28c20 100644
@@ -811,6 +811,8 @@ __weak int fsl_setenv_bootcmd(void)
 	enum boot_src src = get_boot_src();
 	char bootcmd_str[MAX_BOOTCMD_SIZE];
 
+	bootcmd_str[0] = 0;
+
 	switch (src) {
 #ifdef IFC_NOR_BOOTCOMMAND
 	case BOOT_SOURCE_IFC_NOR:
@@ -859,6 +861,9 @@ __weak int fsl_setenv_bootcmd(void)
 		break;
 	}
 
+	if (!bootcmd_str[0])
+		return 0;
+
 	ret = env_set("bootcmd", bootcmd_str);
 	if (ret) {
 		printf("Failed to set bootcmd: ret = %d\n", ret);
Signature · 18 lines
2.34.1


Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: [email protected]
W: www.topic.nl

Please consider the environment before printing this e-mail
Reviewed-by on v1 1/1
#2 lore raw
Quoted 5 lines · Mike Looijmans

When an XXX_BOOTCOMMAND isn't defined, the result is that bootcmd is set to some random memory content. Fix it so that the function does nothing in that case and leaves the bootcmd environment unmodified.

Thanks, Mike.

Fixes 2141d250f510 ("armv8: fsl-layerscape: bootcmd identification for TFABOOT")

regards,
dan carpenter