All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] wifi: mac80211: Two return-value fixes from Clang warning audit
@ 2026-11-19 17:09 Ian Rogers
  2026-11-19 17:09 ` [PATCH 1/2] wifi: mac80211: Return 0 from ieee80211_reconfig_nan_offload_de() Ian Rogers
  2026-11-19 17:09 ` [PATCH 2/2] wifi: mac80211: Return NEG_TTLM_RES_REJECT when sdata is not in driver Ian Rogers
  0 siblings, 2 replies; 3+ messages in thread
From: Ian Rogers @ 2026-11-19 17:09 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, linux-kernel, llvm, Elkin Cruz, Ian Rogers

Two return-value fixes in mac80211 found while auditing Clang
warnings (-Wconditional-uninitialized and -Wimplicit-int-enum-cast)
on an x86_64 allyesconfig build:

1. Return 0 instead of uninitialized res at the end of
   ieee80211_reconfig_nan_offload_de().
2. Return NEG_TTLM_RES_REJECT instead of -EIO in
   drv_can_activate_links() when sdata is not in driver.

Build-tested with LLVM=1 W=1 (-Werror); not runtime-tested on
wireless hardware.

Ian Rogers (2):
  wifi: mac80211: Return 0 from ieee80211_reconfig_nan_offload_de()
  wifi: mac80211: Return NEG_TTLM_RES_REJECT when sdata is not in driver

 net/mac80211/driver-ops.h | 2 +-
 net/mac80211/util.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.56.1.708.g77570a6a1d-goog


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] wifi: mac80211: Return 0 from ieee80211_reconfig_nan_offload_de()
  2026-11-19 17:09 [PATCH 0/2] wifi: mac80211: Two return-value fixes from Clang warning audit Ian Rogers
@ 2026-11-19 17:09 ` Ian Rogers
  2026-11-19 17:09 ` [PATCH 2/2] wifi: mac80211: Return NEG_TTLM_RES_REJECT when sdata is not in driver Ian Rogers
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Rogers @ 2026-11-19 17:09 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, linux-kernel, llvm, Elkin Cruz, Ian Rogers

Commit 589c06e8fdee ("wifi: mac80211: add NAN local schedule support")
factored ieee80211_reconfig_nan_offload_de() out of
ieee80211_reconfig_nan() and added 'return res;' at the end without
initializing res.

When an active NAN interface with offloaded Discovery Engine has no
registered NAN functions in function_inst_ids, the drv_add_nan_func()
loop executes zero iterations and returns uninitialized stack memory
to ieee80211_reconfig_nan(), triggering spurious WARN_ON()s and
reconfig failures during hardware restart or resume. Moreover,
per-function drv_add_nan_func() errors are already handled inside the
loop via ieee80211_nan_func_terminated().

Return 0 after processing the NAN function array, restoring the
pre-589c06e8fdee behavior.

Found via Clang -Wconditional-uninitialized on an x86_64 allyesconfig
build. Verified by building net/mac80211/util.o with LLVM=1 W=1
(-Werror) and -Wconditional-uninitialized; not runtime-tested on NAN
hardware.

Fixes: 589c06e8fdee ("wifi: mac80211: add NAN local schedule support")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 net/mac80211/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 44feb80274c6..9fda135dc112 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1800,7 +1800,7 @@ ieee80211_reconfig_nan_offload_de(struct ieee80211_sub_if_data *sdata)
 	}
 
 	kfree(funcs);
-	return res;
+	return 0;
 }
 
 static int ieee80211_reconfig_nan(struct ieee80211_sub_if_data *sdata)
-- 
2.56.1.708.g77570a6a1d-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] wifi: mac80211: Return NEG_TTLM_RES_REJECT when sdata is not in driver
  2026-11-19 17:09 [PATCH 0/2] wifi: mac80211: Two return-value fixes from Clang warning audit Ian Rogers
  2026-11-19 17:09 ` [PATCH 1/2] wifi: mac80211: Return 0 from ieee80211_reconfig_nan_offload_de() Ian Rogers
@ 2026-11-19 17:09 ` Ian Rogers
  1 sibling, 0 replies; 3+ messages in thread
From: Ian Rogers @ 2026-11-19 17:09 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, linux-kernel, llvm, Elkin Cruz, Ian Rogers

drv_can_neg_ttlm() returns enum ieee80211_neg_ttlm_res and initializes
res to NEG_TTLM_RES_REJECT, but returns -EIO if
!check_sdata_in_driver(sdata).

In ieee80211_process_neg_ttlm_req(), any return value other than
NEG_TTLM_RES_ACCEPT is passed to ieee80211_send_neg_ttlm_res(), where
an out-of-range -EIO value hits 'default: WARN_ON(1); return;'.

Return NEG_TTLM_RES_REJECT instead of -EIO when sdata is not in the
driver.

Found via Clang -Wimplicit-int-enum-cast on an x86_64 allyesconfig
build. Verified by building net/mac80211/mlme.o with LLVM=1 W=1
(-Werror) and -Wimplicit-int-enum-cast; not runtime-tested on MLO
hardware.

Fixes: 8f500fbc6c65 ("wifi: mac80211: process and save negotiated TID to Link mapping request")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 net/mac80211/driver-ops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 9aefa55cbdfd..0558ba58f3fc 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1740,7 +1740,7 @@ drv_can_neg_ttlm(struct ieee80211_local *local,
 
 	might_sleep();
 	if (!check_sdata_in_driver(sdata))
-		return -EIO;
+		return NEG_TTLM_RES_REJECT;
 
 	trace_drv_can_neg_ttlm(local, sdata, neg_ttlm);
 	if (local->ops->can_neg_ttlm)
-- 
2.56.1.708.g77570a6a1d-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-19 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 17:09 [PATCH 0/2] wifi: mac80211: Two return-value fixes from Clang warning audit Ian Rogers
2026-11-19 17:09 ` [PATCH 1/2] wifi: mac80211: Return 0 from ieee80211_reconfig_nan_offload_de() Ian Rogers
2026-11-19 17:09 ` [PATCH 2/2] wifi: mac80211: Return NEG_TTLM_RES_REJECT when sdata is not in driver Ian Rogers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.