[PATCH] staging: wlan-ng: cast to restricted __le16

Greg KH gregkh at linuxfoundation.org
Thu Sep 29 09:00:00 UTC 2016


On Thu, Sep 29, 2016 at 11:54:03AM +0300, Ebru Akagunduz wrote:
> This patch uses __le16 data type to fix le16_to_cpu()
> cast warnings which is found by sparse.
> 
> Signed-off-by: Ebru Akagunduz <ebru.akagunduz at gmail.com>
> ---
>  drivers/staging/wlan-ng/hfa384x.h | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h
> index 4cf4796..1fe1acf 100644
> --- a/drivers/staging/wlan-ng/hfa384x.h
> +++ b/drivers/staging/wlan-ng/hfa384x.h
> @@ -357,7 +357,7 @@ struct hfa384x_bytestr {
>  } __packed;
>  
>  typedef struct hfa384x_bytestr32 {
> -	u16 len;
> +	__le16 len;
>  	u8 data[32];
>  } __packed hfa384x_bytestr32_t;
>  
> @@ -672,16 +672,16 @@ typedef struct hfa384x_ChInfoResult {
>  
>  /*--  Inquiry Frame, Diagnose: Host Scan Results & Subfields--*/
>  typedef struct hfa384x_HScanResultSub {
> -	u16 chid;
> -	u16 anl;
> -	u16 sl;
> +	__le16 chid;
> +	__le16 anl;
> +	__le16 sl;
>  	u8 bssid[WLAN_BSSID_LEN];
> -	u16 bcnint;
> -	u16 capinfo;
> +	__le16 bcnint;
> +	__le16 capinfo;
>  	hfa384x_bytestr32_t ssid;
>  	u8 supprates[10];	/* 802.11 info element */
>  	u16 proberesp_rate;
> -	u16 atim;
> +	__le16 atim;
>  } __packed hfa384x_HScanResultSub_t;

Are you sure these are all really little-endian values?  How do you know
this?

thanks,

greg k-h


More information about the devel mailing list