Skip to content

Commit 1f4672f

Browse files
committed
wifi: wil6210: fix sparse warnings
Sparse warns: drivers/net/wireless/ath/wil6210/fw.c: note: in included file (through drivers/net/wireless/ath/wil6210/wil6210.h): drivers/net/wireless/ath/wil6210/fw.h:96:47: warning: array of flexible structures drivers/net/wireless/ath/wil6210/cfg80211.c: note: in included file (through drivers/net/wireless/ath/wil6210/wil6210.h): drivers/net/wireless/ath/wil6210/fw.h:96:47: warning: array of flexible structures I decided to remove the combos field altogether and just do pointer arithmetic instead. Not pretty but I didn't want to waste too much time on an orphaned driver. Compile tested only. Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com> Link: https://msgid.link/20240320182449.3757215-5-kvalo@kernel.org
1 parent 1eb2ac4 commit 1f4672f

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

drivers/net/wireless/ath/wil6210/cfg80211.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,7 +2735,7 @@ int wil_cfg80211_iface_combinations_from_fw(
27352735
return 0;
27362736
}
27372737

2738-
combo = conc->combos;
2738+
combo = (const struct wil_fw_concurrency_combo *)(conc + 1);
27392739
n_combos = le16_to_cpu(conc->n_combos);
27402740
for (i = 0; i < n_combos; i++) {
27412741
total_limits += combo->n_limits;
@@ -2751,7 +2751,7 @@ int wil_cfg80211_iface_combinations_from_fw(
27512751
return -ENOMEM;
27522752
iface_limit = (struct ieee80211_iface_limit *)(iface_combinations +
27532753
n_combos);
2754-
combo = conc->combos;
2754+
combo = (const struct wil_fw_concurrency_combo *)(conc + 1);
27552755
for (i = 0; i < n_combos; i++) {
27562756
iface_combinations[i].max_interfaces = combo->max_interfaces;
27572757
iface_combinations[i].num_different_channels =

drivers/net/wireless/ath/wil6210/fw.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ struct wil_fw_record_concurrency { /* type == wil_fw_type_comment */
9393
/* number of concurrency combinations that follow */
9494
__le16 n_combos;
9595
/* keep last - combinations, variable size by n_combos */
96-
struct wil_fw_concurrency_combo combos[];
9796
} __packed;
9897

9998
/* brd file info encoded inside a comment record */

drivers/net/wireless/ath/wil6210/fw_inc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ fw_handle_concurrency(struct wil6210_priv *wil, const void *data,
212212
}
213213

214214
n_combos = le16_to_cpu(rec->n_combos);
215-
remain = size - offsetof(struct wil_fw_record_concurrency, combos);
216-
combo = rec->combos;
215+
remain = size - sizeof(struct wil_fw_record_concurrency);
216+
combo = (const struct wil_fw_concurrency_combo *)(rec + 1);
217217
for (i = 0; i < n_combos; i++) {
218218
if (remain < sizeof(*combo))
219219
goto out_short;

0 commit comments

Comments
 (0)