Search Linux Wireless

Re: [PATCH] wifi: mac80211_hwsim: do not ignore the value returned by nla_put_u32()

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

 



On Mon, 2023-08-14 at 12:21 +0300, Dmitry Antipov wrote:
> In 'mac80211_hwsim_vendor_cmd_test()', do not ignore the value
> returned by 'nla_put_u32'. This follows commit b970ac68e0c4
> ("wifi: mac80211_hwsim: check the return value of nla_put_u32").
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Dmitry Antipov <dmantipov@xxxxxxxxx>
> ---
>  drivers/net/wireless/virtual/mac80211_hwsim.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c
> index f446fd0e8cd0..2a3393a47bf2 100644
> --- a/drivers/net/wireless/virtual/mac80211_hwsim.c
> +++ b/drivers/net/wireless/virtual/mac80211_hwsim.c
> @@ -597,9 +597,9 @@ static int mac80211_hwsim_vendor_cmd_test(struct wiphy *wiphy,
>  	/* skb_put() or nla_put() will fill up data within
>  	 * NL80211_ATTR_VENDOR_DATA
>  	 */
> -	nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_TEST, val + 2);
> +	err = nla_put_u32(skb, QCA_WLAN_VENDOR_ATTR_TEST, val + 2);
>  
> -	return cfg80211_vendor_cmd_reply(skb);
> +	return err ? err : cfg80211_vendor_cmd_reply(skb);
> 

You can use ?: here, but more importantly, this introduces a memory
leak.

johannes




[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