From 1cc809fe0d6ed0af4f91a6d187ae463d06e7d47a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Sat, 21 Dec 2013 19:19:15 +0200 Subject: [PATCH] Fix CBMEM console overflow MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- 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; } /**************************************************************** -- 2.39.5