aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/printk.c
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2010-08-09 20:20:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-09 23:45:06 -0400
commit8c4af38e9b2c2a78369c4e2e5706fe539ac64eb2 (patch)
tree17671814cc7afb4e5eaafad32f0ed0c428764515 /kernel/printk.c
parent547415d5edf8660aee040dc81d8c71b081a59bda (diff)
gcc-4.6: printk: use stable variable to dump kmsg buffer
kmsg_dump takes care to sample the global variables inside a spinlock, but then goes on to use the same variables outside the spinlock region too. Use the correct variable. This will make the race window smaller. Found by gcc 4.6's new warnings. Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/printk.c')
-rw-r--r--kernel/printk.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index 4ab0164bcf84..8fe465ac008a 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1549,9 +1549,9 @@ void kmsg_dump(enum kmsg_dump_reason reason)
1549 chars = logged_chars; 1549 chars = logged_chars;
1550 spin_unlock_irqrestore(&logbuf_lock, flags); 1550 spin_unlock_irqrestore(&logbuf_lock, flags);
1551 1551
1552 if (logged_chars > end) { 1552 if (chars > end) {
1553 s1 = log_buf + log_buf_len - logged_chars + end; 1553 s1 = log_buf + log_buf_len - chars + end;
1554 l1 = logged_chars - end; 1554 l1 = chars - end;
1555 1555
1556 s2 = log_buf; 1556 s2 = log_buf;
1557 l2 = end; 1557 l2 = end;
@@ -1559,8 +1559,8 @@ void kmsg_dump(enum kmsg_dump_reason reason)
1559 s1 = ""; 1559 s1 = "";
1560 l1 = 0; 1560 l1 = 0;
1561 1561
1562 s2 = log_buf + end - logged_chars; 1562 s2 = log_buf + end - chars;
1563 l2 = logged_chars; 1563 l2 = chars;
1564 } 1564 }
1565 1565
1566 if (!spin_trylock_irqsave(&dump_list_lock, flags)) { 1566 if (!spin_trylock_irqsave(&dump_list_lock, flags)) {