From: Chen Gang <gang.chen@asianux.com>
To: Catalin Marinas <Catalin.Marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
vgupta@synopsys.com, Tony Lindgren <tony@atomide.com>,
Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Rusty Russell <rusty@rustcorp.com.au>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Linux-Arch <linux-arch@vger.kernel.org>
Subject: [PATCH v2] arch: arm64: kernel: sprintf(), 'str' needs additional 1 byte for failure processing
Date: Mon, 27 May 2013 10:00:12 +0800 [thread overview]
Message-ID: <51A2BE2C.2000004@asianux.com> (raw)
In-Reply-To: <51A1E3B3.4060901@asianux.com>
When failure occurs at the last looping cycle (when 'i == 0'), it will
print "bad PC value" instead of "(%08x) ", which needs additional 1
byte.
If not add 1 byte, the 'str' may be memory overflow.
Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
arch/arm64/kernel/traps.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 61d7dd2..c2f68d2 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -100,7 +100,7 @@ static void dump_instr(const char *lvl, struct pt_regs *regs)
{
unsigned long addr = instruction_pointer(regs);
mm_segment_t fs;
- char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str;
+ char str[sizeof("00000000 ") * 5 + 2 + 1 + 1], *p = str;
int i;
/*
--
1.7.7.6
WARNING: multiple messages have this Message-ID (diff)
From: gang.chen@asianux.com (Chen Gang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] arch: arm64: kernel: sprintf(), 'str' needs additional 1 byte for failure processing
Date: Mon, 27 May 2013 10:00:12 +0800 [thread overview]
Message-ID: <51A2BE2C.2000004@asianux.com> (raw)
In-Reply-To: <51A1E3B3.4060901@asianux.com>
When failure occurs at the last looping cycle (when 'i == 0'), it will
print "bad PC value" instead of "(%08x) ", which needs additional 1
byte.
If not add 1 byte, the 'str' may be memory overflow.
Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
arch/arm64/kernel/traps.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/arm64/kernel/traps.c b/arch/arm64/kernel/traps.c
index 61d7dd2..c2f68d2 100644
--- a/arch/arm64/kernel/traps.c
+++ b/arch/arm64/kernel/traps.c
@@ -100,7 +100,7 @@ static void dump_instr(const char *lvl, struct pt_regs *regs)
{
unsigned long addr = instruction_pointer(regs);
mm_segment_t fs;
- char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str;
+ char str[sizeof("00000000 ") * 5 + 2 + 1 + 1], *p = str;
int i;
/*
--
1.7.7.6
next prev parent reply other threads:[~2013-05-27 2:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-26 10:28 [PATCH] arch: arm64: kernel: sprintf(), 'str' needs additional 1 byte for failure processing Chen Gang
2013-05-26 10:28 ` Chen Gang
2013-05-27 1:42 ` Chen Gang
2013-05-27 1:42 ` Chen Gang
2013-05-27 2:00 ` Chen Gang [this message]
2013-05-27 2:00 ` [PATCH v2] " Chen Gang
2013-05-28 10:42 ` Will Deacon
2013-05-28 10:42 ` Will Deacon
2013-05-28 10:42 ` Will Deacon
2013-05-28 11:21 ` Chen Gang
2013-05-28 11:21 ` 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=51A2BE2C.2000004@asianux.com \
--to=gang.chen@asianux.com \
--cc=Catalin.Marinas@arm.com \
--cc=akpm@linux-foundation.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=santosh.shilimkar@ti.com \
--cc=tony@atomide.com \
--cc=vgupta@synopsys.com \
--cc=will.deacon@arm.com \
/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.