[PATCH] zImage-arm: init modified_cmdline with zero

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

 



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"

Signed-off-by: Wang Nan <wangnan0 at huawei.com>
Cc: Geng Hui <hui.geng at huawei.com>

---
 kexec/arch/arm/kexec-zImage-arm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kexec/arch/arm/kexec-zImage-arm.c b/kexec/arch/arm/kexec-zImage-arm.c
index 220826e..4b5d3f4 100644
--- a/kexec/arch/arm/kexec-zImage-arm.c
+++ b/kexec/arch/arm/kexec-zImage-arm.c
@@ -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);
-- 
1.8.4




[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux