diff mbox series

[04/12] wifi: rndis_wlan: fix array of flexible structures warning

Message ID 20220904212910.0e7ce5fdbcfb.I972158734def3f93b93a3858a087cbc2cca6337e@changeid (mailing list archive)
State Accepted
Commit c70a9d6783cf51cbd7c3241fec6a5ac24d99b79d
Delegated to: Kalle Valo
Headers show
Series [01/12] wifi: ipw2100: fix warnings about non-kernel-doc | expand

Commit Message

Johannes Berg Sept. 4, 2022, 7:29 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

Use "u8 bssid_data[]" with an appropriate cast. No binary
changes.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 drivers/net/wireless/rndis_wlan.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Kalle Valo Sept. 5, 2022, 3:39 p.m. UTC | #1
Johannes Berg <johannes@sipsolutions.net> writes:

> From: Johannes Berg <johannes.berg@intel.com>
>
> Use "u8 bssid_data[]" with an appropriate cast. No binary
> changes.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
>  drivers/net/wireless/rndis_wlan.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
> index 325933217b41..82a7458e01ae 100644
> --- a/drivers/net/wireless/rndis_wlan.c
> +++ b/drivers/net/wireless/rndis_wlan.c
> @@ -251,7 +251,7 @@ struct ndis_80211_bssid_ex {
>  
>  struct ndis_80211_bssid_list_ex {
>  	__le32 num_items;
> -	struct ndis_80211_bssid_ex bssid[];
> +	u8 bssid_data[];
>  } __packed;
>  
>  struct ndis_80211_fixed_ies {
> @@ -2084,7 +2084,8 @@ static int rndis_check_bssid_list(struct usbnet *usbdev, u8 *match_bssid,
>  	netdev_dbg(usbdev->net, "%s(): buflen: %d\n", __func__, len);
>  
>  	bssid_len = 0;
> -	bssid = next_bssid_list_item(bssid_list->bssid, &bssid_len, buf, len);
> +	bssid = next_bssid_list_item((void *)bssid_list->bssid_data,
> +				     &bssid_len, buf, len);

Same comment as in patch 2, I just feel the code gets worse because of a
compiler warning.
diff mbox series

Patch

diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index 325933217b41..82a7458e01ae 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -251,7 +251,7 @@  struct ndis_80211_bssid_ex {
 
 struct ndis_80211_bssid_list_ex {
 	__le32 num_items;
-	struct ndis_80211_bssid_ex bssid[];
+	u8 bssid_data[];
 } __packed;
 
 struct ndis_80211_fixed_ies {
@@ -2084,7 +2084,8 @@  static int rndis_check_bssid_list(struct usbnet *usbdev, u8 *match_bssid,
 	netdev_dbg(usbdev->net, "%s(): buflen: %d\n", __func__, len);
 
 	bssid_len = 0;
-	bssid = next_bssid_list_item(bssid_list->bssid, &bssid_len, buf, len);
+	bssid = next_bssid_list_item((void *)bssid_list->bssid_data,
+				     &bssid_len, buf, len);
 
 	/* Device returns incorrect 'num_items'. Workaround by ignoring the
 	 * received 'num_items' and walking through full bssid buffer instead.