Skip to content

Commit d195c39

Browse files
committed
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/[email protected]/ Link: https://lore.kernel.org/lkml/20200526135429.GQ12456@shao2-debian Signed-off-by: Kees Cook <[email protected]>
1 parent 563ca40 commit d195c39

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

fs/pstore/platform.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,15 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c)
514514
}
515515

516516
static struct console pstore_console = {
517-
.name = "pstore",
518517
.write = pstore_console_write,
519518
.index = -1,
520519
};
521520

522521
static void pstore_register_console(void)
523522
{
523+
/* Show which backend is going to get console writes. */
524+
strscpy(pstore_console.name, psinfo->name,
525+
sizeof(pstore_console.name));
524526
/*
525527
* Always initialize flags here since prior unregister_console()
526528
* calls may have changed settings (specifically CON_ENABLED).

tools/testing/selftests/pstore/pstore_tests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
. ./common_tests
1111

1212
prlog -n "Checking pstore console is registered ... "
13-
dmesg | grep -q "console \[pstore"
13+
dmesg | grep -Eq "console \[(pstore|${backend})"
1414
show_result $?
1515

1616
prlog -n "Checking /dev/pmsg0 exists ... "

0 commit comments

Comments
 (0)