[RFC PATCH 10/11] printk: survive rotation of sequence numbers

From: Petr Mladek
Date: Fri May 09 2014 - 05:15:41 EST


NMI log buffer uses half of "unsigned long" to store the sequence number.
The maximum value might be relatively small, especially on 32-bit systems.
This patch makes the check for free space more strict, so it does give
false results after the rotation.

Signed-off-by: Petr Mladek <pmladek@xxxxxxx>
---
kernel/printk/printk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 874ebab41ba3..9c97b6daccc3 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -540,7 +540,7 @@ static int log_make_free_space(struct printk_log *log, u32 msg_size)
int freed = 0;
int ret = 0;

- while (get_first_seq(log) < get_next_seq(log)) {
+ while (get_first_seq(log) != get_next_seq(log)) {
if (logbuf_has_space(log, msg_size, false))
goto out;

--
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/