Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zImage-arm: init modified_cmdline with zero
@ 2014-05-04 13:03 Wang Nan
  2014-05-11  0:22 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Wang Nan @ 2014-05-04 13:03 UTC (permalink / raw)
  To: Simon Horman, Dave Young; +Cc: Wang Nan, kexec, Geng Hui

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@huawei.com>
Cc: Geng Hui <hui.geng@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


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [PATCH] zImage-arm: init modified_cmdline with zero
  2014-05-04 13:03 [PATCH] zImage-arm: init modified_cmdline with zero Wang Nan
@ 2014-05-11  0:22 ` Simon Horman
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2014-05-11  0:22 UTC (permalink / raw)
  To: Wang Nan; +Cc: kexec, Dave Young, Geng Hui

On Sun, May 04, 2014 at 09:03:53PM +0800, Wang Nan wrote:
> 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@huawei.com>
> Cc: Geng Hui <hui.geng@huawei.com>

Thanks, applied.

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

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

end of thread, other threads:[~2014-05-11  8:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-04 13:03 [PATCH] zImage-arm: init modified_cmdline with zero Wang Nan
2014-05-11  0:22 ` Simon Horman

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