On 03/22/2012 01:30 AM, Dan Carpenter wrote:
> Hello Tim Bird,
>
> This is a semi-automatic email about new static checker warnings.
>
> The patch 3492c71d374c: "kdb: Avoid using dbg_io_ops until it is 
> initialized" from Sep 21, 2011, leads to the following Smatch 
> complaint:
>
> kernel/debug/kdb/kdb_io.c:746 vkdb_printf()
>        error: we previously assumed 'dbg_io_ops' could be null (see line 692)
>
> kernel/debug/kdb/kdb_io.c
>    691                } else {
>    692                        if (dbg_io_ops && !dbg_io_ops->is_console) {
>                             ^^^^^^^^^^
> New check.
>
>    693                                len = strlen(kdb_buffer);
>    694                                cp = kdb_buffer;
>    695                                while (len--) {
>    696                                        dbg_io_ops->write_char(*cp);
>    697                                        cp++;
>    698                                }
>    699                        }
>
>       [snip]
>
>    742        
>    743                        kdb_input_flush();
>    744                        c = console_drivers;
>    745        
>    746                        if (!dbg_io_ops->is_console) {
>                              ^^^^^^^^^^
> Old dereference.  Should we check here as well?

I had the same question when I reviewed and tested this code.  This section of 
code is protected by the kdb pager block, where dbg_io_ops cannot be null.

Should I be adding a comment to that effect, or just pay the price for the null 
check to squelch the warning?

Jason.

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Kgdb-bugreport mailing list
Kgdb-bugreport@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to