From e2804c14a48ce18db2f225a738f681d1b79f8a40 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Thu, 20 Jul 2017 00:53:53 +0200 Subject: [PATCH] util/vgabios: Don't call redefined printk in printk A few pieces of coreboot code (like the video bios emulator) are imported from other code bases, and hence might call printf. In order to see the output, we redefine printf to printk. However, when we are re-importing this code in a userspace utility, we might call printk instead of printf if we're not careful. A good fix for this would be to not call printf in coreboot ever. As a short term fix to keep testbios from segfaulting, we just don't call printf from printk, so we don't cause our own stack to overflow. Change-Id: I789075422dd8c5f8069d576fa7baf4176f6caf55 Signed-off-by: Stefan Reinauer Reviewed-on: https://review.coreboot.org/20658 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Martin Roth --- util/vgabios/testbios.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/vgabios/testbios.c b/util/vgabios/testbios.c index 095ea48ec9..ba63ab3031 100644 --- a/util/vgabios/testbios.c +++ b/util/vgabios/testbios.c @@ -102,7 +102,10 @@ int printk(int msg_level, const char *fmt, ...) va_list args; int i; - printf ("<%d> ", msg_level); + putchar('<'); + putchar('0' + msg_level); + putchar('>'); + putchar(' '); va_start(args, fmt); i = vprintf(fmt, args); va_end(args);