Skip to contentSkip to conversation

zImage-arm: init modified_cmdline with zero

PATCH Applied Wang Nan 2 participants 2 messages May 4, 2014 – May 11, 2014

Subsystems (2)
lore
Share & tools
lore

Wang Nan

author
#0 lore raw

PATCH 1/1 zImage-arm: init modified_cmdline with zero

This patch memset modified_cmdline after it alloced.

Without this patch, the header of command line always contains random value like following example:

kernel: 0x765fd008 kernel_size: 0x23b610
memory range: [0x60000000 - 0x6fffffff] (256M) memory range: [0x78000000 - 0x9fffffff] (640M)
...
kernel command line: "°¥氥䐶# elfcorehdr=0x77f00000 mem=130048K"

---
 kexec/arch/arm/kexec-zImage-arm.c | 2 ++
 1 file changed, 2 insertions(+)
kexec/arch/arm/kexec-zImage-arm.c +2 -0
index 220826e..4b5d3f4 100644
@@ -378,6 +378,8 @@ int zImage_arm_load(int argc, char **argv, const char *buf, off_t len,
 		if (!modified_cmdline)
 			return -1;
 
+		memset(modified_cmdline, '\0', COMMAND_LINE_SIZE);
+
 		if (command_line) {
 			(void) strncpy(modified_cmdline, command_line,
 				       COMMAND_LINE_SIZE);
Signature · 7 lines
1.8.4


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Applied
#1 lore raw
Quoted 5 lines · Wang Nan

This patch memset modified_cmdline after it alloced.

Without this patch, the header of command line always contains random value like following example:

Quoted 8 lines

kernel: 0x765fd008 kernel_size: 0x23b610
memory range: [0x60000000 - 0x6fffffff] (256M) memory range: [0x78000000 - 0x9fffffff] (640M)
...
kernel command line: "°¥氥䐶# elfcorehdr=0x77f00000 mem=130048K"

Thanks, applied.

Quoted 21 lines
---
 kexec/arch/arm/kexec-zImage-arm.c | 2 ++
 1 file changed, 2 insertions(+)
kexec/arch/arm/kexec-zImage-arm.c +2 -0
index 220826e..4b5d3f4 100644
@@ -378,6 +378,8 @@ int zImage_arm_load(int argc, char **argv, const char *buf, off_t len,
 		if (!modified_cmdline)
 			return -1;
 
+		memset(modified_cmdline, '\0', COMMAND_LINE_SIZE);
+
 		if (command_line) {
 			(void) strncpy(modified_cmdline, command_line,
 				       COMMAND_LINE_SIZE);
Signature · 1 line
1.8.4

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec