All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] staging: r8188eu: Fix smatch warnings in os_dep/*.c
@ 2021-09-17 13:15 Dan Carpenter
  2021-09-17 18:26 ` Martin Kaiser
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-09-17 13:15 UTC (permalink / raw)
  To: Larry.Finger, Martin Kaiser; +Cc: linux-staging


Hello Larry and Martin,

The patch 0d5e4bfe47ea: "staging: r8188eu: Fix smatch warnings in
os_dep/*.c" from Aug 11, 2021, leads to the following
Smatch static checker warning:

	drivers/staging/r8188eu/os_dep/usb_intf.c:286 rtw_hw_resume()
	warn: variable dereferenced before check 'padapter' (see line 284)

drivers/staging/r8188eu/os_dep/usb_intf.c
    281 int rtw_hw_resume(struct adapter *padapter)
    282 {
    283         struct pwrctrl_priv *pwrpriv;
    284         struct net_device *pnetdev = padapter->pnetdev;
                                             ^^^^^^^^^^^^^^^^^
Dereferenced

    285 
--> 286         if (!padapter)
                    ^^^^^^^^^

Checked too late.

This warning was silenced when Smatch could tell that "padapter" was
non-NULL but Martin removed the last caller in commit c0a099b7341c
("staging: r8188eu: bHWPwrPindetect is always false").

So the correct fix is to just delete this function?

    287                 goto error_exit;
    288         pwrpriv = &padapter->pwrctrlpriv;
    289         DBG_88E("==> rtw_hw_resume\n");
    290         _enter_pwrlock(&pwrpriv->lock);
    291         pwrpriv->bips_processing = true;
    292         rtw_reset_drv_sw(padapter);
    293 

regards,
dan carpenter

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

* Re: [bug report] staging: r8188eu: Fix smatch warnings in os_dep/*.c
  2021-09-17 13:15 [bug report] staging: r8188eu: Fix smatch warnings in os_dep/*.c Dan Carpenter
@ 2021-09-17 18:26 ` Martin Kaiser
  0 siblings, 0 replies; 2+ messages in thread
From: Martin Kaiser @ 2021-09-17 18:26 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Larry.Finger, linux-staging

Hello Dan,

Thus wrote Dan Carpenter (dan.carpenter@oracle.com):

> Hello Larry and Martin,

> The patch 0d5e4bfe47ea: "staging: r8188eu: Fix smatch warnings in
> os_dep/*.c" from Aug 11, 2021, leads to the following
> Smatch static checker warning:

> 	drivers/staging/r8188eu/os_dep/usb_intf.c:286 rtw_hw_resume()
> 	warn: variable dereferenced before check 'padapter' (see line 284)

> drivers/staging/r8188eu/os_dep/usb_intf.c
>     281 int rtw_hw_resume(struct adapter *padapter)
>     282 {
>     283         struct pwrctrl_priv *pwrpriv;
>     284         struct net_device *pnetdev = padapter->pnetdev;
>                                              ^^^^^^^^^^^^^^^^^
> Dereferenced

>     285 
> --> 286         if (!padapter)
>                     ^^^^^^^^^

> Checked too late.

> This warning was silenced when Smatch could tell that "padapter" was
> non-NULL but Martin removed the last caller in commit c0a099b7341c
> ("staging: r8188eu: bHWPwrPindetect is always false").

> So the correct fix is to just delete this function?

yes, rtw_hw_resume is no longer used. I submitted a patch to remove the
function. I'll have to rebase and resend it.

Best regards,
Martin

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

end of thread, other threads:[~2021-09-17 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 13:15 [bug report] staging: r8188eu: Fix smatch warnings in os_dep/*.c Dan Carpenter
2021-09-17 18:26 ` Martin Kaiser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.