diff options
author | Andrew Lunn <andrew@lunn.ch> | 2012-06-05 02:52:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-12 19:20:17 -0400 |
commit | 6ebb017de9d59a18c3ff9648270e8f6abaa93438 (patch) | |
tree | 771410dbbeec9cba3629b27336b2eb4af30b58b1 | |
parent | bcc2c9c3fff859e0eb019fe6fec26f9b8eba795c (diff) |
printk: Fix alignment of buf causing crash on ARM EABI
Commit 7ff9554bb578ba02166071d2d487b7fc7d860d62, printk: convert
byte-buffer to variable-length record buffer, causes systems using
EABI to crash very early in the boot cycle. The first entry in struct
log is a u64, which for EABI must be 8 byte aligned.
Make use of __alignof__() so the compiler to decide the alignment, but
allow it to be overridden using CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS,
for systems which can perform unaligned access and want to save
a few bytes of space.
Tested on Orion5x and Kirkwood.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Kay Sievers <kay@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | kernel/printk.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 32462d2b364a..f205c25c37e2 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -227,10 +227,10 @@ static u32 clear_idx; | |||
227 | #define LOG_LINE_MAX 1024 | 227 | #define LOG_LINE_MAX 1024 |
228 | 228 | ||
229 | /* record buffer */ | 229 | /* record buffer */ |
230 | #if !defined(CONFIG_64BIT) || defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | 230 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) |
231 | #define LOG_ALIGN 4 | 231 | #define LOG_ALIGN 4 |
232 | #else | 232 | #else |
233 | #define LOG_ALIGN 8 | 233 | #define LOG_ALIGN __alignof__(struct log) |
234 | #endif | 234 | #endif |
235 | #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) | 235 | #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) |
236 | static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); | 236 | static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN); |