From: Chen Gang <gang.chen@asianux.com>
To: benh@kernel.crashing.org, paulus@samba.org
Cc: linuxppc-dev@lists.ozlabs.org
Subject: [PATCH] arch/powerpc/kernel: using %12.12s instead of %12s for avoiding memory overflow.
Date: Thu, 24 Jan 2013 12:14:52 +0800 [thread overview]
Message-ID: <5100B53C.3030109@asianux.com> (raw)
for tmp_part->header.name:
it is "Terminating null required only for names < 12 chars".
so need to limit the %.12s for it in printk
additional info:
%12s limit the width, not for the original string output length
if name length is more than 12, it still can be fully displayed.
if name length is less than 12, the ' ' will be filled before name.
%.12s truly limit the original string output length (precision)
Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
arch/powerpc/kernel/nvram_64.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index bec1e93..57bf6d2 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -202,7 +202,7 @@ static void __init nvram_print_partitions(char * label)
printk(KERN_WARNING "--------%s---------\n", label);
printk(KERN_WARNING "indx\t\tsig\tchks\tlen\tname\n");
list_for_each_entry(tmp_part, &nvram_partitions, partition) {
- printk(KERN_WARNING "%4d \t%02x\t%02x\t%d\t%12s\n",
+ printk(KERN_WARNING "%4d \t%02x\t%02x\t%d\t%12.12s\n",
tmp_part->index, tmp_part->header.signature,
tmp_part->header.checksum, tmp_part->header.length,
tmp_part->header.name);
--
1.7.10.4
next reply other threads:[~2013-01-24 4:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-24 4:14 Chen Gang [this message]
2013-02-17 4:00 ` [PATCH] arch/powerpc/kernel: using %12.12s instead of %12s for avoiding memory overflow Chen Gang
2013-03-25 4:30 ` Chen Gang
2013-04-24 7:45 ` Chen Gang
2013-04-24 7:45 ` Chen Gang
2013-04-24 8:15 ` Vasant Hegde
2013-04-24 8:15 ` Vasant Hegde
2013-04-24 8:19 ` Vasant Hegde
2013-04-24 8:19 ` Vasant Hegde
2013-04-24 8:31 ` Chen Gang
2013-04-24 8:31 ` Chen Gang
2013-03-12 0:39 ` Chen Gang
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=5100B53C.3030109@asianux.com \
--to=gang.chen@asianux.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.