Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Wang Nan <wangnan0@huawei.com>
To: Simon Horman <horms@verge.net.au>, Dave Young <dyoung@redhat.com>
Cc: Wang Nan <wangnan0@huawei.com>,
	kexec@lists.infradead.org, Geng Hui <hui.geng@huawei.com>
Subject: [PATCH] zImage-arm: init modified_cmdline with zero
Date: Sun, 4 May 2014 21:03:53 +0800	[thread overview]
Message-ID: <1399208633-62071-1-git-send-email-wangnan0@huawei.com> (raw)

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

             reply	other threads:[~2014-05-04 13:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-04 13:03 Wang Nan [this message]
2014-05-11  0:22 ` [PATCH] zImage-arm: init modified_cmdline with zero Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1399208633-62071-1-git-send-email-wangnan0@huawei.com \
    --to=wangnan0@huawei.com \
    --cc=dyoung@redhat.com \
    --cc=horms@verge.net.au \
    --cc=hui.geng@huawei.com \
    --cc=kexec@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox