]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: nl80211: call kfree without a NULL check
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Mon, 20 Oct 2025 07:57:45 +0000 (10:57 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 20 Oct 2025 11:57:26 +0000 (13:57 +0200)
Coverity is unhappy because we may leak old_radio_rts_threshold. Since
this pointer is only valid in the context of the function and kfree is
NULL pointer safe, don't check and just call kfree.
Note that somehow, we were checking old_rts_threshold to free
old_radio_rts_threshold which is a bit odd.

Fixes: 264637941cf4 ("wifi: cfg80211: Add Support to Set RTS Threshold for each Radio")
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Link: https://patch.msgid.link/20251020075745.44168-1-emmanuel.grumbach@intel.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/nl80211.c

index 346dfd2bd9879c44d35f518a8bdedba78018ab87..03d07b54359a45c05c45628808aaebf79e38920e 100644 (file)
@@ -4136,8 +4136,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
                        rdev->wiphy.txq_quantum = old_txq_quantum;
                }
 
-               if (old_rts_threshold)
-                       kfree(old_radio_rts_threshold);
+               kfree(old_radio_rts_threshold);
                return result;
        }