Skip to content
Snippets Groups Projects
Commit 8c4af38e authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds
Browse files

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: default avatarAndi Kleen <ak@linux.intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 547415d5
No related branches found
No related tags found
No related merge requests found
...@@ -1549,9 +1549,9 @@ void kmsg_dump(enum kmsg_dump_reason reason) ...@@ -1549,9 +1549,9 @@ void kmsg_dump(enum kmsg_dump_reason reason)
chars = logged_chars; chars = logged_chars;
spin_unlock_irqrestore(&logbuf_lock, flags); spin_unlock_irqrestore(&logbuf_lock, flags);
if (logged_chars > end) { if (chars > end) {
s1 = log_buf + log_buf_len - logged_chars + end; s1 = log_buf + log_buf_len - chars + end;
l1 = logged_chars - end; l1 = chars - end;
s2 = log_buf; s2 = log_buf;
l2 = end; l2 = end;
...@@ -1559,8 +1559,8 @@ void kmsg_dump(enum kmsg_dump_reason reason) ...@@ -1559,8 +1559,8 @@ void kmsg_dump(enum kmsg_dump_reason reason)
s1 = ""; s1 = "";
l1 = 0; l1 = 0;
s2 = log_buf + end - logged_chars; s2 = log_buf + end - chars;
l2 = logged_chars; l2 = chars;
} }
if (!spin_trylock_irqsave(&dump_list_lock, flags)) { if (!spin_trylock_irqsave(&dump_list_lock, flags)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment