]> xenbits.xensource.com Git - seabios.git/commitdiff
Fix CBMEM console overflow
authorKyösti Mälkki <kyosti.malkki@gmail.com>
Sat, 21 Dec 2013 17:19:15 +0000 (19:19 +0200)
committerKevin O'Connor <kevin@koconnor.net>
Sun, 22 Dec 2013 15:40:22 +0000 (10:40 -0500)
In CBMEM console, cursor increments past the buffer size to
indicate the number of characters missing from log output.

Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
src/fw/coreboot.c

index 5b7e77a4b08eda8b35dcd4a325d32b5b258ec249..cc316dff817fc7d2ee8870ba1564d1ca2d7daca3 100644 (file)
@@ -208,9 +208,9 @@ void coreboot_debug_putc(char c)
         return;
     if (!cbcon)
         return;
-    if (cbcon->buffer_cursor == cbcon->buffer_size)
-        return;
-    cbcon->buffer_body[cbcon->buffer_cursor++] = c;
+    u32 cursor = cbcon->buffer_cursor++;
+    if (cursor < cbcon->buffer_size)
+        cbcon->buffer_body[cursor] = c;
 }
 
 /****************************************************************