mac80211: brcmfmac: backport fixes for 4.7 and 4.8
[openwrt.git] / package / kernel / mac80211 / patches / 351-0001-brcmfmac-testing-the-wrong-variable-in-brcmf_rx_hdrp.patch
1 From: Dan Carpenter <dan.carpenter@oracle.com>
2 Date: Tue, 19 Apr 2016 07:25:43 -0700
3 Subject: [PATCH] brcmfmac: testing the wrong variable in brcmf_rx_hdrpull()
4
5 Smatch complains about this code:
6
7     drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c:335 brcmf_rx_hdrpull()
8     error: we previously assumed '*ifp' could be null (see line 333)
9
10 The problem is that we recently changed these from "ifp" to "*ifp" but
11 there was one that we didn't update.
12
13 -       if (ret || !ifp || !ifp->ndev) {
14 +       if (ret || !(*ifp) || !(*ifp)->ndev) {
15                 if (ret != -ENODATA && ifp)
16                                        ^^^
17 -                       ifp->stats.rx_errors++;
18 +                       (*ifp)->stats.rx_errors++;
19
20 I have updated it to *ifp as well.  We always call this function is a
21 non-NULL "ifp" pointer, btw.
22
23 Fixes: c462ebcdfe42 ('brcmfmac: create common function for handling brcmf_proto_hdrpull()')
24 Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
25 Acked-by: Arend van Spriel <arend@broadcom.com>
26 Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
27 ---
28
29 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
30 +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
31 @@ -331,7 +331,7 @@ static int brcmf_rx_hdrpull(struct brcmf
32         ret = brcmf_proto_hdrpull(drvr, true, skb, ifp);
33  
34         if (ret || !(*ifp) || !(*ifp)->ndev) {
35 -               if (ret != -ENODATA && ifp)
36 +               if (ret != -ENODATA && *ifp)
37                         (*ifp)->stats.rx_errors++;
38                 brcmu_pkt_buf_free_skb(skb);
39                 return -ENODATA;