Skip to content
Permalink
Browse files
staging: rtl8732bs: incorrect type in assignment
Cast u32 to __le32 with __cpu_to_le32 to fix sparse warning:

warning: incorrect type in assignment (different base types)
expected restricted __le32 [usertype]
got unsigned int

Signed-off-by: Aakash Hemadri <aakashhemadri123@gmail.com>
  • Loading branch information
aakashhemadri authored and intel-lab-lkp committed Aug 16, 2021
1 parent 7c60610 commit e416b56afe8ba715b03a7a058ee5424be5fe97f8
Showing 1 changed file with 7 additions and 4 deletions.
@@ -8,6 +8,7 @@
#include <drv_types.h>
#include <rtw_debug.h>
#include <crypto/aes.h>
#include <linux/byteorder/little_endian.h>

static const char * const _security_type_str[] = {
"N/A",
@@ -69,15 +70,15 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)

length = pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;

*((__le32 *)crc) = ~crc32_le(~0, payload, length);
*((__le32 *)crc) = __cpu_to_le32(~crc32_le(~0, payload, length));

arc4_setkey(ctx, wepkey, 3 + keylength);
arc4_crypt(ctx, payload, payload, length);
arc4_crypt(ctx, payload + length, crc, 4);

} else {
length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
*((__le32 *)crc) = ~crc32_le(~0, payload, length);
*((__le32 *)crc) = __cpu_to_le32(~crc32_le(~0, payload, length));
arc4_setkey(ctx, wepkey, 3 + keylength);
arc4_crypt(ctx, payload, payload, length);
arc4_crypt(ctx, payload + length, crc, 4);
@@ -506,15 +507,17 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe)

if ((curfragnum+1) == pattrib->nr_frags) { /* 4 the last fragment */
length = pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
*((__le32 *)crc) = ~crc32_le(~0, payload, length);
*((__le32 *)crc) =
__cpu_to_le32(~crc32_le(~0, payload, length));

arc4_setkey(ctx, rc4key, 16);
arc4_crypt(ctx, payload, payload, length);
arc4_crypt(ctx, payload + length, crc, 4);

} else {
length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-pattrib->icv_len;
*((__le32 *)crc) = ~crc32_le(~0, payload, length);
*((__le32 *)crc) =
__cpu_to_le32(~crc32_le(~0, payload, length));

arc4_setkey(ctx, rc4key, 16);
arc4_crypt(ctx, payload, payload, length);

0 comments on commit e416b56

Please sign in to comment.