[SeaBIOS] [PATCH] Fix CBMEM console overflow
Kyösti Mälkki
kyosti.malkki at gmail.com
Sat Dec 21 18:19:15 CET 2013
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 at gmail.com>
---
src/fw/coreboot.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c
index 5b7e77a..cc316df 100644
--- a/src/fw/coreboot.c
+++ b/src/fw/coreboot.c
@@ -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;
}
/****************************************************************
--
1.8.1.1
More information about the SeaBIOS
mailing list