Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

pstore/platform: Use backend name for console registration

If the pstore backend changes, there's no indication in the logs what
the console is (it always says "pstore"). Instead, pass through the
active backend's name. (Also adjust the selftest to match.)

Link: https://lore.kernel.org/lkml/20200510202436.63222-5-keescook@chromium.org/
Link: https://lore.kernel.org/lkml/20200526135429.GQ12456@shao2-debian
Signed-off-by: Kees Cook <keescook@chromium.org>

+4 -2
+3 -1
fs/pstore/platform.c
··· 514 514 } 515 515 516 516 static struct console pstore_console = { 517 - .name = "pstore", 518 517 .write = pstore_console_write, 519 518 .index = -1, 520 519 }; 521 520 522 521 static void pstore_register_console(void) 523 522 { 523 + /* Show which backend is going to get console writes. */ 524 + strscpy(pstore_console.name, psinfo->name, 525 + sizeof(pstore_console.name)); 524 526 /* 525 527 * Always initialize flags here since prior unregister_console() 526 528 * calls may have changed settings (specifically CON_ENABLED).
+1 -1
tools/testing/selftests/pstore/pstore_tests
··· 10 10 . ./common_tests 11 11 12 12 prlog -n "Checking pstore console is registered ... " 13 - dmesg | grep -q "console \[pstore" 13 + dmesg | grep -Eq "console \[(pstore|${backend})" 14 14 show_result $? 15 15 16 16 prlog -n "Checking /dev/pmsg0 exists ... "