Search Linux Wireless

RE: [PATCH] Add non-null judgement branch for return value of mt76_connac_get_he_phy_cap().

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hzy15610046011 <houzhanyi61@xxxxxxxxxxx> wrote:
> 
> From: H-Mole <houzhanyi61@xxxxxxxxxxx>
> 
> Since commit https://github.com/torvalds/linux/commit/f503ae90c7355e8506e68498fe84c1357894cd5b

The pattern to reference commit is "commit + 12digits + subject", such as: 
   commit f503ae90c735 ("wifi: mt76: mt7996: fix NULL pointer dereference in mt7996_mcu_sta_bfer_he")

>  showed that drivers/net/wireless/mediatek/mt76/mt7996/mcu.c misses a non-null judgement for the
>  return value of mt76_connac_get_he_phy_cap on variable vc, this null-pointer problem may also happen
>  on mt7915. This commit added such non-null judgement like what was added to function
> mt7996_mcu_sta_bfer_he()
>  in commit f503ae90c7355e8506e68498fe84c1357894cd5b.

Have you run checkpatch before sending out?

> 
> Signed-off-by: H-Mole <houzhanyi61@xxxxxxxxxxx>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> index 427542777abc..5dca50d40080 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c
> @@ -1184,6 +1184,9 @@ mt7915_mcu_sta_bfer_he(struct ieee80211_sta *sta, struct ieee80211_vif *vif,
>         u8 nss_mcs = mt7915_mcu_get_sta_nss(mcs_map);
>         u8 snd_dim, sts;
> 
> +       if (!vc)
> +               return;
> +

Before checking vc, ve is induced by vc already. 

        const struct ieee80211_he_cap_elem *ve = &vc->he_cap_elem;

Though pointer doesn't really access the data, it would be better to get
the pointer after checking vc.

>         bf->tx_mode = MT_PHY_TYPE_HE_SU;
> 
>         mt7915_mcu_sta_sounding_rate(bf);
> --
> 2.39.5
> 






[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux