Skip to content

Commit 78724b8

Browse files
committed
kdb: Fix smatch warning on dbg_io_ops->is_console
The Smatch tool warned that the change from commit b8adde8 (kdb: Avoid using dbg_io_ops until it is initialized) should add another null check later in the kdb_printf(). It is worth noting that the second use of dbg_io_ops->is_console is protected by the KDB_PAGER state variable which would only get set when kdb is fully active and initialized. If we ever encounter changes or defects in the KDB_PAGER state we do not want to crash the kernel in a kdb_printf/printk. CC: Tim Bird <tim.bird@am.sony.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
1 parent 1ba0c17 commit 78724b8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/debug/kdb/kdb_io.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ int vkdb_printf(const char *fmt, va_list ap)
743743
kdb_input_flush();
744744
c = console_drivers;
745745

746-
if (!dbg_io_ops->is_console) {
746+
if (dbg_io_ops && !dbg_io_ops->is_console) {
747747
len = strlen(moreprompt);
748748
cp = moreprompt;
749749
while (len--) {

0 commit comments

Comments
 (0)