linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723au: Mark type casts to __le32 as intentional
@ 2015-09-22  7:24 Lars Svensson
  2015-09-22 21:30 ` Larry Finger
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Svensson @ 2015-09-22  7:24 UTC (permalink / raw)
  To: Larry.Finger
  Cc: Jes.Sorensen, gregkh, m.v.b, gdonald, joe, ruchandani.tina,
	linux-wireless, devel, linux-kernel, Lars Svensson, Lars Svensson

Fixing Sparse warnings about intentional type casts in rtw_security.c
as below.

  CHECK   drivers/staging/rtl8723au/core/rtw_security.c
drivers/staging/rtl8723au/core/rtw_security.c:248:22: \
warning: cast to restricted __le32
drivers/staging/rtl8723au/core/rtw_security.c:249:24: \
warning: cast to restricted __le32
drivers/staging/rtl8723au/core/rtw_security.c:776:22: \
warning: cast to restricted __le32
drivers/staging/rtl8723au/core/rtw_security.c:777:24: \
warning: cast to restricted __le32

Signed-off-by: Lars Svensson <Lars1.Svensson@sonymobile.com>
---
 drivers/staging/rtl8723au/core/rtw_security.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_security.c b/drivers/staging/rtl8723au/core/rtw_security.c
index 3d40bab..311dfc1 100644
--- a/drivers/staging/rtl8723au/core/rtw_security.c
+++ b/drivers/staging/rtl8723au/core/rtw_security.c
@@ -213,6 +213,7 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter,
 {
 	/*  exclude ICV */
 	u32 actual_crc, expected_crc;
+	__le32 crc_le;
 	struct arc4context mycontext;
 	int length;
 	u32 keylength;
@@ -245,8 +246,10 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter,
 	arcfour_encrypt(&mycontext, payload, payload, length);
 
 	/* calculate icv and compare the icv */
-	actual_crc = le32_to_cpu(getcrc32(payload, length - 4));
-	expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4]));
+	crc_le = (__force __le32)getcrc32(payload, length - 4);
+	actual_crc = le32_to_cpu(crc_le);
+	crc_le = (__force __le32)get_unaligned_le32(&payload[length - 4]);
+	expected_crc = le32_to_cpu(crc_le);
 
 	if (actual_crc != expected_crc) {
 		RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
@@ -717,6 +720,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
 	u8 rc4key[16];
 	u8 ttkey[16];
 	u32 actual_crc, expected_crc;
+	__le32 crc_le;
 	struct arc4context mycontext;
 	int length;
 	u32 prwskeylen;
@@ -772,9 +776,10 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
 	/* 4 decrypt payload include icv */
 	arcfour_init(&mycontext, rc4key, 16);
 	arcfour_encrypt(&mycontext, payload, payload, length);
-
-	actual_crc = le32_to_cpu(getcrc32(payload, length - 4));
-	expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4]));
+	crc_le = (__force __le32)getcrc32(payload, length - 4);
+	actual_crc = le32_to_cpu(crc_le);
+	crc_le = (__force __le32)get_unaligned_le32(&payload[length - 4]);
+	expected_crc = le32_to_cpu(crc_le);
 
 	if (actual_crc != expected_crc) {
 		RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-- 
2.4.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-26 17:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-22  7:24 [PATCH] staging: rtl8723au: Mark type casts to __le32 as intentional Lars Svensson
2015-09-22 21:30 ` Larry Finger
2015-09-23 10:11   ` Lars Svensson
2015-09-24  7:11     ` [PATCH V2] staging: rtl8723au: Remove unneeded endianness conversions Lars Svensson
2015-09-26 17:54       ` Larry Finger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).