2023-08-14 09:52:12

by Dmitry Antipov

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

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 <[email protected]>
---
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);
}

static struct wiphy_vendor_command mac80211_hwsim_vendor_commands[] = {
--
2.41.0