From: Kalle Valo <kvalo@codeaurora.org>
To: trix@redhat.com
Cc: arend.vanspriel@broadcom.com, franky.lin@broadcom.com,
hante.meuleman@broadcom.com, chi-hsien.lin@cypress.com,
wright.feng@cypress.com, davem@davemloft.net, kuba@kernel.org,
rafal@milecki.pl, tklauser@distanz.ch,
linux-wireless@vger.kernel.org,
brcm80211-dev-list.pdl@broadcom.com,
brcm80211-dev-list@cypress.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Tom Rix <trix@redhat.com>
Subject: Re: [PATCH] brcmfmac: check ndev pointer
Date: Tue, 18 Aug 2020 12:50:04 +0000 (UTC) [thread overview]
Message-ID: <20200818125004.77FBEC433A0@smtp.codeaurora.org> (raw)
In-Reply-To: <20200802161804.6126-1-trix@redhat.com>
trix@redhat.com wrote:
> From: Tom Rix <trix@redhat.com>
>
> Clang static analysis reports this error
>
> brcmfmac/core.c:490:4: warning: Dereference of null pointer
> (*ifp)->ndev->stats.rx_errors++;
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> In this block of code
>
> if (ret || !(*ifp) || !(*ifp)->ndev) {
> if (ret != -ENODATA && *ifp)
> (*ifp)->ndev->stats.rx_errors++;
> brcmu_pkt_buf_free_skb(skb);
> return -ENODATA;
> }
>
> (*ifp)->ndev being NULL is caught as an error
> But then it is used to report the error.
>
> So add a check before using it.
>
> Fixes: 91b632803ee4 ("brcmfmac: Use net_device_stats from struct net_device")
> Signed-off-by: Tom Rix <trix@redhat.com>
Patch applied to wireless-drivers-next.git, thanks.
9c9f015bc9f8 brcmfmac: check ndev pointer
--
https://patchwork.kernel.org/patch/11696567/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
prev parent reply other threads:[~2020-08-18 12:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-02 16:18 [PATCH] brcmfmac: check ndev pointer trix
2020-08-18 12:50 ` Kalle Valo [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200818125004.77FBEC433A0@smtp.codeaurora.org \
--to=kvalo@codeaurora.org \
--cc=arend.vanspriel@broadcom.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=brcm80211-dev-list@cypress.com \
--cc=chi-hsien.lin@cypress.com \
--cc=davem@davemloft.net \
--cc=franky.lin@broadcom.com \
--cc=hante.meuleman@broadcom.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rafal@milecki.pl \
--cc=tklauser@distanz.ch \
--cc=trix@redhat.com \
--cc=wright.feng@cypress.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).