From 40379fee97252cab05eb401e8ff726d0c251302c Mon Sep 17 00:00:00 2001 From: Shen Mintao Date: Sat, 8 Aug 2026 12:18:17 +0800 Subject: [PATCH] fix: support Linux 7.2 cfg80211 API --- drivers/aic8800/aic8800_fdrv/rwnx_main.c | 12 +++++++++++- drivers/aic8800/aic8800_fdrv/rwnx_msg_tx.c | 8 +++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_main.c b/drivers/aic8800/aic8800_fdrv/rwnx_main.c index aeb5daa..594e4f9 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_main.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_main.c @@ -4857,7 +4857,17 @@ rwnx_cfg80211_remain_on_channel(struct wiphy *wiphy, #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) enum nl80211_channel_type channel_type, #endif - unsigned int duration, u64 *cookie) + unsigned int duration, u64 *cookie +#if LINUX_VERSION_CODE >= KERNEL_VERSION(7, 2, 0) + /* + * 7.2 added an optional receive address filter for the off-channel + * period. cfg80211 refuses a non-NULL one unless the driver sets + * NL80211_EXT_FEATURE_ROC_ADDR_FILTER, which this one does not, so it + * is always NULL here. mac80211 ignores it in the same way. + */ + , const u8 *rx_addr +#endif + ) { return rwnx_cfg80211_remain_on_channel_(wiphy, #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 6, 0) diff --git a/drivers/aic8800/aic8800_fdrv/rwnx_msg_tx.c b/drivers/aic8800/aic8800_fdrv/rwnx_msg_tx.c index b977555..6c54759 100644 --- a/drivers/aic8800/aic8800_fdrv/rwnx_msg_tx.c +++ b/drivers/aic8800/aic8800_fdrv/rwnx_msg_tx.c @@ -4849,7 +4849,13 @@ int rwnx_send_dbg_trigger_req(struct rwnx_hw *rwnx_hw, char *msg) return -ENOMEM; /* Set parameters for the MM_DBG_TRIGGER_REQ message */ - strncpy(req->error, msg, sizeof(req->error)); + /* + * strncpy() is gone in 7.2. req->error is a fixed 64-byte field of a + * firmware message that is not NUL-terminated, and the message came + * from kzalloc(), so copying at most the field size is all strncpy() + * did here. + */ + memcpy(req->error, msg, strnlen(msg, sizeof(req->error))); /* Send the MM_DBG_TRIGGER_REQ message to LMAC FW */ return rwnx_send_msg(rwnx_hw, req, 0, -1, NULL);