lkml.org 
[lkml]   [2013]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] arch: arm64: kernel: sprintf(), 'str' needs additional 1 byte for failure processing

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 will not be NUL terminated, and the next
printk() will cause issue.

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

\
 
 \ /
  Last update: 2013-05-26 13:01    [W:0.058 / U:1.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site