Search Linux Wireless

Re: [PATCH 02/12] wifi: ipw2x00: fix array of flexible structures warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Berg <johannes@xxxxxxxxxxxxxxxx> writes:

> From: Johannes Berg <johannes.berg@xxxxxxxxx>
>
> There are a number of these here, fix them by using
> appropriate casts. No binary changes.
>
> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
> ---
>  drivers/net/wireless/intel/ipw2x00/libipw.h    | 13 ++++++-------
>  drivers/net/wireless/intel/ipw2x00/libipw_rx.c | 10 +++++-----
>  2 files changed, 11 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/wireless/intel/ipw2x00/libipw.h b/drivers/net/wireless/intel/ipw2x00/libipw.h
> index 7964ef7d15f0..bec7bc273748 100644
> --- a/drivers/net/wireless/intel/ipw2x00/libipw.h
> +++ b/drivers/net/wireless/intel/ipw2x00/libipw.h
> @@ -405,7 +405,7 @@ struct libipw_auth {
>  	__le16 transaction;
>  	__le16 status;
>  	/* challenge */
> -	struct libipw_info_element info_element[];
> +	u8 variable[];

Why u8 is better?

> --- a/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
> +++ b/drivers/net/wireless/intel/ipw2x00/libipw_rx.c
> @@ -1329,8 +1329,8 @@ static int libipw_handle_assoc_resp(struct libipw_device *ieee, struct libipw_as
>  	network->wpa_ie_len = 0;
>  	network->rsn_ie_len = 0;
>  
> -	if (libipw_parse_info_param
> -	    (frame->info_element, stats->len - sizeof(*frame), network))
> +	if (libipw_parse_info_param((void *)frame->variable,
> +				    stats->len - sizeof(*frame), network))

To me this look worse as we need to add an extra cast, and casts are
always problematic.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux