Skip to content

Commit

Permalink
kdb: Fix smatch warning on dbg_io_ops->is_console
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jason Wessel committed Mar 29, 2012
1 parent 1ba0c17 commit 78724b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/debug/kdb/kdb_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ int vkdb_printf(const char *fmt, va_list ap)
kdb_input_flush();
c = console_drivers;

if (!dbg_io_ops->is_console) {
if (dbg_io_ops && !dbg_io_ops->is_console) {
len = strlen(moreprompt);
cp = moreprompt;
while (len--) {
Expand Down

0 comments on commit 78724b8

Please sign in to comment.