Vladimir Serbinenko (phcoder@gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2991
-gerrit
commit c98ba8d709dc81889d5318f7f79167b725a23b99 Author: Vladimir Serbinenko phcoder@gmail.com Date: Sat Mar 30 12:15:12 2013 +0100
Don't output trailing garbage for cbmemc
Change-Id: I68c1970cf84d49b2d7d6007dae0679d7a7a0cb99 Signed-off-by: Vladimir Serbinenko phcoder@gmail.com --- util/cbmem/cbmem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c index bc6bd6b..56c7237 100644 --- a/util/cbmem/cbmem.c +++ b/util/cbmem/cbmem.c @@ -328,6 +328,8 @@ static void dump_console(void) * Hence we have to add 8 to get to the actual console string. */ size = *(uint32_t *)console_p; + if (size > *(uint32_t *) (console_p + 4)) + size = *(uint32_t *) (console_p + 4); console_c = malloc(size + 1); if (!console_c) { fprintf(stderr, "Not enough memory for console.\n"); @@ -337,7 +339,9 @@ static void dump_console(void) memcpy(console_c, console_p + 8, size); console_c[size] = 0;
- printf("%s", console_c); + printf("%s\n", console_c); + if (size < *(uint32_t *) (console_p + 4)) + printf ("%dB lost\n", *(uint32_t *) (console_p + 4) - size);
free(console_c);