lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zh4vz0xs.fsf@codeaurora.org>
Date:   Fri, 09 Oct 2020 21:52:47 +0300
From:   Kalle Valo <kvalo@...eaurora.org>
To:     Jerome Pouiller <Jerome.Pouiller@...abs.com>
Cc:     devel@...verdev.osuosl.org, linux-wireless@...r.kernel.org,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "David S . Miller" <davem@...emloft.net>,
        Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH 3/8] staging: wfx: standardize the error when vif does not exist

Jerome Pouiller <Jerome.Pouiller@...abs.com> writes:

> From: Jérôme Pouiller <jerome.pouiller@...abs.com>
>
> Smatch complains:
>
>    drivers/staging/wfx/hif_rx.c:177 hif_scan_complete_indication() warn: potential NULL parameter dereference 'wvif'
>    drivers/staging/wfx/data_tx.c:576 wfx_flush() warn: potential NULL parameter dereference 'wvif'
>
> Indeed, if the vif id returned by the device does not exist anymore,
> wdev_to_wvif() could return NULL.
>
> In add, the error is not handled uniformly in the code, sometime a
> WARN() is displayed but code continue, sometime a dev_warn() is
> displayed, sometime it is just not tested, ...
>
> This patch standardize that.
>
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Jérôme Pouiller <jerome.pouiller@...abs.com>
> ---
>  drivers/staging/wfx/data_tx.c |  5 ++++-
>  drivers/staging/wfx/hif_rx.c  | 34 ++++++++++++++++++++++++----------
>  drivers/staging/wfx/sta.c     |  4 ++++
>  3 files changed, 32 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/staging/wfx/data_tx.c b/drivers/staging/wfx/data_tx.c
> index b4d5dd3d2d23..8db0be08daf8 100644
> --- a/drivers/staging/wfx/data_tx.c
> +++ b/drivers/staging/wfx/data_tx.c
> @@ -431,7 +431,10 @@ static void wfx_skb_dtor(struct wfx_vif *wvif, struct sk_buff *skb)
>  			      sizeof(struct hif_req_tx) +
>  			      req->fc_offset;
>  
> -	WARN_ON(!wvif);
> +	if (!wvif) {
> +		pr_warn("%s: vif associated with the skb does not exist anymore\n", __func__);
> +		return;
> +	}

I'm not really a fan of using function names in warning or error
messages as it clutters the log. In debug messages I think they are ok.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ