Skip to contentSkip to conversation

wifi: nl80211: remove redundant null pointer check in coalescing

PATCH New Dmitry Kandybka 1 participant 1 message Oct 3, 2024 802.11 (including cfg80211/NL80211)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: nl80211: remove redundant null pointer check in coalescing

In 'cfg80211_free_coalesce', '&coalesce->rules[i]' is a pointer to VLA member of 'struct cfg80211_coalesce' and should never be NULL, so redundant check may be dropped.

I think this is correct, but I haven't tested it seriously. Compile tested only.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

---
 net/wireless/nl80211.c | 2 --
 1 file changed, 2 deletions(-)
net/wireless/nl80211.c +0 -2
index 9ab777e0bd4d..b71fa8beea1f 100644
@@ -14061,8 +14061,6 @@ void cfg80211_free_coalesce(struct cfg80211_coalesce *coalesce)
 
 	for (i = 0; i < coalesce->n_rules; i++) {
 		rule = &coalesce->rules[i];
-		if (!rule)
-			continue;
 		for (j = 0; j < rule->n_patterns; j++)
 			kfree(rule->patterns[j].mask);
 		kfree(rule->patterns);
Signature · 1 line
2.43.5