linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: ath: Add support for tracing
@ 2014-10-03 12:11 Dan Carpenter
  2014-10-03 12:13 ` Dan Carpenter
  2014-10-06  5:34 ` Sujith Manoharan
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-10-03 12:11 UTC (permalink / raw)
  To: c_manoha; +Cc: linux-wireless

Hello Sujith Manoharan,

This is a semi-automatic email about new static checker warnings.

The patch e6664dff0608: "ath: Add support for tracing" from Sep 27, 
2014, leads to the following Smatch complaint:

drivers/net/wireless/ath/main.c:88 ath_printk()
	 error: we previously assumed 'common->hw' could be null (see line 82)

drivers/net/wireless/ath/main.c
    81	
    82		if (common && common->hw && common->hw->wiphy)
                              ^^^^^^^^^^
Existing code assumes common->hw can be NULL.

    83			printk("%sath: %s: %pV",
    84			       level, wiphy_name(common->hw->wiphy), &vaf);
    85		else
    86			printk("%sath: %pV", level, &vaf);
    87	
    88		trace_ath_log(common->hw->wiphy, &vaf);
                              ^^^^^^^^^^^^^^^^^
New code dereferences it without checking for NULL.

    89	
    90		va_end(args);

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ath: Add support for tracing
  2014-10-03 12:11 ath: Add support for tracing Dan Carpenter
@ 2014-10-03 12:13 ` Dan Carpenter
  2014-10-06  5:34 ` Sujith Manoharan
  1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-10-03 12:13 UTC (permalink / raw)
  To: c_manoha; +Cc: linux-wireless

On Fri, Oct 03, 2014 at 03:11:01PM +0300, Dan Carpenter wrote:
> Hello Sujith Manoharan,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch e6664dff0608: "ath: Add support for tracing" from Sep 27, 
> 2014, leads to the following Smatch complaint:
> 
> drivers/net/wireless/ath/main.c:88 ath_printk()
> 	 error: we previously assumed 'common->hw' could be null (see line 82)
> 
> drivers/net/wireless/ath/main.c
>     81	
>     82		if (common && common->hw && common->hw->wiphy)

Oh.  And also common is assumed to be possibly NULL as well.

regards,
dan carpenter

>                               ^^^^^^^^^^
> Existing code assumes common->hw can be NULL.
> 
>     83			printk("%sath: %s: %pV",
>     84			       level, wiphy_name(common->hw->wiphy), &vaf);
>     85		else
>     86			printk("%sath: %pV", level, &vaf);
>     87	
>     88		trace_ath_log(common->hw->wiphy, &vaf);
>                               ^^^^^^^^^^^^^^^^^
> New code dereferences it without checking for NULL.
> 
>     89	
>     90		va_end(args);
> 
> regards,
> dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

* re: ath: Add support for tracing
  2014-10-03 12:11 ath: Add support for tracing Dan Carpenter
  2014-10-03 12:13 ` Dan Carpenter
@ 2014-10-06  5:34 ` Sujith Manoharan
  1 sibling, 0 replies; 3+ messages in thread
From: Sujith Manoharan @ 2014-10-06  5:34 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-wireless

Dan Carpenter wrote:
> Hello Sujith Manoharan,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch e6664dff0608: "ath: Add support for tracing" from Sep 27, 
> 2014, leads to the following Smatch complaint:
> 
> drivers/net/wireless/ath/main.c:88 ath_printk()
> 	 error: we previously assumed 'common->hw' could be null (see line 82)

Thanks.

ath_printk() would be called only if ath_hw/ath_common are setup,
so the chances of common being NULL is pretty low.

But, since we are interested in trace information with a functional
driver, trace_ath_log() can be moved inside the check. I'll send
a patch.

Sujith

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-06  5:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-03 12:11 ath: Add support for tracing Dan Carpenter
2014-10-03 12:13 ` Dan Carpenter
2014-10-06  5:34 ` Sujith Manoharan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).