diff mbox

[OPW,kernel] staging:vt6656: Fix sparse warnings

Message ID 20140317072939.GA4219@himangi-Inspiron-N5110gmail.com
State New, archived
Headers show

Commit Message

HIMANGI SARAOGI March 17, 2014, 7:29 a.m. UTC
This patch fixes the following sparse warnings:
drivers/staging/vt6656/aes_ccmp.c:272:32: warning: restricted __le16 degrades to integer
drivers/staging/vt6656/aes_ccmp.c:274:32: warning: restricted __le16 degrades to integer
drivers/staging/vt6656/aes_ccmp.c:282:32: warning: restricted __le16 degrades to integer

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
---
 drivers/staging/vt6656/aes_ccmp.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Pablo Neira Ayuso March 17, 2014, 9:55 a.m. UTC | #1
On Mon, Mar 17, 2014 at 12:59:40PM +0530, Himangi Saraogi wrote:
> This patch fixes the following sparse warnings:
> drivers/staging/vt6656/aes_ccmp.c:272:32: warning: restricted __le16 degrades to integer
> drivers/staging/vt6656/aes_ccmp.c:274:32: warning: restricted __le16 degrades to integer
> drivers/staging/vt6656/aes_ccmp.c:282:32: warning: restricted __le16 degrades to integer
> 
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> ---
>  drivers/staging/vt6656/aes_ccmp.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/vt6656/aes_ccmp.c b/drivers/staging/vt6656/aes_ccmp.c
> index 61b9f7b..b8804f4 100644
> --- a/drivers/staging/vt6656/aes_ccmp.c
> +++ b/drivers/staging/vt6656/aes_ccmp.c
> @@ -269,9 +269,9 @@ bool AESbGenCCMP(u8 *pbyRxKey, u8 *pbyFrame, u16 wFrameSize)
>  	/* MIC_HDR1 */
>  	MIC_HDR1[0] = (u8)(wHLen >> 8);
>  	MIC_HDR1[1] = (u8)(wHLen & 0xff);
> -	byTmp = (u8)(pMACHeader->frame_control & 0xff);
> +	byTmp = (u8)(le16_to_cpu(pMACHeader->frame_control) & 0xff);
>  	MIC_HDR1[2] = byTmp & 0x8f;
> -	byTmp = (u8)(pMACHeader->frame_control >> 8);
> +	byTmp = (u8)(le16_to_cpu(pMACHeader->frame_control) >> 8);

I'm sure this calms down sparse. But looking at that code, are you
100% sure that this is working after this change?

>  	byTmp &= 0x87;
>  	MIC_HDR1[3] = byTmp | 0x40;
>  	memcpy(&(MIC_HDR1[4]), pMACHeader->addr1, ETH_ALEN);
> @@ -279,7 +279,7 @@ bool AESbGenCCMP(u8 *pbyRxKey, u8 *pbyFrame, u16 wFrameSize)
>  
>  	/* MIC_HDR2 */
>  	memcpy(&(MIC_HDR2[0]), pMACHeader->addr3, ETH_ALEN);
> -	byTmp = (u8)(pMACHeader->seq_ctrl & 0xff);
> +	byTmp = (u8)(le16_to_cpu(pMACHeader->seq_ctrl) & 0xff);
>  	MIC_HDR2[6] = byTmp & 0x0f;
>  	MIC_HDR2[7] = 0;
>  
> -- 
> 1.7.9.5
> 
> -- 
> You received this message because you are subscribed to the Google Groups "opw-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to opw-kernel+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
diff mbox

Patch

diff --git a/drivers/staging/vt6656/aes_ccmp.c b/drivers/staging/vt6656/aes_ccmp.c
index 61b9f7b..b8804f4 100644
--- a/drivers/staging/vt6656/aes_ccmp.c
+++ b/drivers/staging/vt6656/aes_ccmp.c
@@ -269,9 +269,9 @@  bool AESbGenCCMP(u8 *pbyRxKey, u8 *pbyFrame, u16 wFrameSize)
 	/* MIC_HDR1 */
 	MIC_HDR1[0] = (u8)(wHLen >> 8);
 	MIC_HDR1[1] = (u8)(wHLen & 0xff);
-	byTmp = (u8)(pMACHeader->frame_control & 0xff);
+	byTmp = (u8)(le16_to_cpu(pMACHeader->frame_control) & 0xff);
 	MIC_HDR1[2] = byTmp & 0x8f;
-	byTmp = (u8)(pMACHeader->frame_control >> 8);
+	byTmp = (u8)(le16_to_cpu(pMACHeader->frame_control) >> 8);
 	byTmp &= 0x87;
 	MIC_HDR1[3] = byTmp | 0x40;
 	memcpy(&(MIC_HDR1[4]), pMACHeader->addr1, ETH_ALEN);
@@ -279,7 +279,7 @@  bool AESbGenCCMP(u8 *pbyRxKey, u8 *pbyFrame, u16 wFrameSize)
 
 	/* MIC_HDR2 */
 	memcpy(&(MIC_HDR2[0]), pMACHeader->addr3, ETH_ALEN);
-	byTmp = (u8)(pMACHeader->seq_ctrl & 0xff);
+	byTmp = (u8)(le16_to_cpu(pMACHeader->seq_ctrl) & 0xff);
 	MIC_HDR2[6] = byTmp & 0x0f;
 	MIC_HDR2[7] = 0;