Skip to contentSkip to conversation

wifi: mac80211: initialize result for empty NAN function list

PATCH New Artemii Mashanov 1 participant 1 message Nov 12 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: mac80211: initialize result for empty NAN function list

ieee80211_reconfig_nan_offload_de() may be called with no registered NAN functions. In this case, the restoration loop is skipped and res is returned without being initialized.

Initialize res to zero so that reconfiguration succeeds when there are no NAN functions to restore.

This also fixes the uninitialized variable warning from Smatch.

---
 net/mac80211/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/util.c +1 -1
index 69abd4e3f..155c4b66c 100644
@@ -1772,7 +1772,7 @@ static int
 ieee80211_reconfig_nan_offload_de(struct ieee80211_sub_if_data *sdata)
 {
 	struct cfg80211_nan_func *func, **funcs;
-	int res, id, i = 0;
+	int res = 0, id, i = 0;
 
 	funcs = kzalloc_objs(*funcs, sdata->local->hw.max_nan_de_entries + 1);
 	if (!funcs)
Signature · 1 line
2.56.0