staging: rtl8732bs: Fix sparse warnings
cover staging: rtl8732bs: Fix sparse warnings
This patchset fixes the below sparse warnings
rtw_security.c:72:50: warning: incorrect type in assignment (different base types)
rtw_security.c:72:50: expected restricted __le32 [usertype]
rtw_security.c:72:50: got unsigned int
rtw_security.c:80:50: warning: incorrect type in assignment (different base types)
rtw_security.c:80:50: expected restricted __le32 [usertype]
rtw_security.c:80:50: got unsigned int
rtw_security.c:124:33: warning: cast to restricted __le32 rtw_security.c:509:58: warning: incorrect type in assignment (different base types)
rtw_security.c:509:58: expected restricted __le32 [usertype]
rtw_security.c:509:58: got unsigned int
rtw_security.c:517:58: warning: incorrect type in assignment (different base types)
rtw_security.c:517:58: expected restricted __le32 [usertype]
rtw_security.c:517:58: got unsigned int
rtw_security.c:621:41: warning: cast to restricted __le32
This can be applied cleanly on next-20210816, and is compile tested.
Please ignore the duplicate of this patchset, I did not CC staging. Message ID: <[email protected]>
Aakash Hemadri (2):
staging: rtl8732bs: incorrect type in assignment
staging: rtl8723bs: cast to restricted __le32
drivers/staging/rtl8723bs/core/rtw_security.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
Signature · 1 line
2.32.0
PATCH 1/2 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
--- drivers/staging/rtl8723bs/core/rtw_security.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/staging/rtl8723bs/core/rtw_security.c +7 -4
@@ -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,7 +70,7 @@ 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);
@@ -77,7 +78,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe) }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,7 +507,8 @@ 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);
@@ -514,7 +516,8 @@ u32 rtw_tkip_encrypt(struct adapter *padapter, u8 *pxmitframe) }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);
Signature · 1 line
2.32.0
kernel test robot
build botRe: [PATCH 1/2] staging: rtl8732bs: incorrect type in assignment
Thank you for the patch! Yet something to improve:
Hi Aakash,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on v5.14-rc6]
[cannot apply to staging/staging-testing next-20210816]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Aakash-Hemadri/staging-rtl8732bs-Fix-sparse-warnings/20210817-013634 base: 7c60610d476766e128cc4284bb6349732cbd6606 config: parisc-allyesconfig (attached as .config) compiler: hppa-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/e416b56afe8ba715b03a7a058ee5424be5fe97f8
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Aakash-Hemadri/staging-rtl8732bs-Fix-sparse-warnings/20210817-013634
git checkout e416b56afe8ba715b03a7a058ee5424be5fe97f8
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=parisc SHELL=/bin/bash drivers/staging/rtl8723bs/
If you fix the issue, kindly add following tag as appropriate
All error/warnings (new ones prefixed by >>):
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:15: warning: "__constant_htonl" redefined
15 | #define __constant_htonl(x) ((__force __be32)___constant_swab32((x)))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:15: note: this is the location of the previous definition
15 | #define __constant_htonl(x) ((__force __be32)(__u32)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:16: warning: "__constant_ntohl" redefined
16 | #define __constant_ntohl(x) ___constant_swab32((__force __be32)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:16: note: this is the location of the previous definition
16 | #define __constant_ntohl(x) ((__force __u32)(__be32)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:17: warning: "__constant_htons" redefined
17 | #define __constant_htons(x) ((__force __be16)___constant_swab16((x)))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:17: note: this is the location of the previous definition
17 | #define __constant_htons(x) ((__force __be16)(__u16)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:18: warning: "__constant_ntohs" redefined
18 | #define __constant_ntohs(x) ___constant_swab16((__force __be16)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:18: note: this is the location of the previous definition
18 | #define __constant_ntohs(x) ((__force __u16)(__be16)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:19: warning: "__constant_cpu_to_le64" redefined
19 | #define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:19: note: this is the location of the previous definition
19 | #define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:20: warning: "__constant_le64_to_cpu" redefined
20 | #define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:20: note: this is the location of the previous definition
20 | #define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:21: warning: "__constant_cpu_to_le32" redefined
21 | #define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:21: note: this is the location of the previous definition
21 | #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:22: warning: "__constant_le32_to_cpu" redefined
22 | #define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:22: note: this is the location of the previous definition
22 | #define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:23: warning: "__constant_cpu_to_le16" redefined
23 | #define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:23: note: this is the location of the previous definition
23 | #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:24: warning: "__constant_le16_to_cpu" redefined
24 | #define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:24: note: this is the location of the previous definition
24 | #define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:25: warning: "__constant_cpu_to_be64" redefined
25 | #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x)))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:25: note: this is the location of the previous definition
25 | #define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:26: warning: "__constant_be64_to_cpu" redefined
26 | #define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:26: note: this is the location of the previous definition
26 | #define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:27: warning: "__constant_cpu_to_be32" redefined
27 | #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:27: note: this is the location of the previous definition
27 | #define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:28: warning: "__constant_be32_to_cpu" redefined
28 | #define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:28: note: this is the location of the previous definition
28 | #define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:29: warning: "__constant_cpu_to_be16" redefined
29 | #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x)))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:29: note: this is the location of the previous definition
29 | #define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:30: warning: "__constant_be16_to_cpu" redefined
30 | #define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:30: note: this is the location of the previous definition
30 | #define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:31: warning: "__cpu_to_le64" redefined
31 | #define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:31: note: this is the location of the previous definition
31 | #define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:32: warning: "__le64_to_cpu" redefined
32 | #define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:32: note: this is the location of the previous definition
32 | #define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:33: warning: "__cpu_to_le32" redefined
33 | #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:33: note: this is the location of the previous definition
33 | #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
>> include/uapi/linux/byteorder/little_endian.h:34: warning: "__le32_to_cpu" redefined
34 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:34: note: this is the location of the previous definition
34 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
include/uapi/linux/byteorder/little_endian.h:35: warning: "__cpu_to_le16" redefined
35 | #define __cpu_to_le16(x) ((__force __le16)(__u16)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:35: note: this is the location of the previous definition
35 | #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
include/uapi/linux/byteorder/little_endian.h:36: warning: "__le16_to_cpu" redefined
36 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:36: note: this is the location of the previous definition
36 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
include/uapi/linux/byteorder/little_endian.h:37: warning: "__cpu_to_be64" redefined
37 | #define __cpu_to_be64(x) ((__force __be64)__swab64((x)))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:37: note: this is the location of the previous definition
37 | #define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
include/uapi/linux/byteorder/little_endian.h:38: warning: "__be64_to_cpu" redefined
38 | #define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
|
In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5,
from arch/parisc/include/asm/bitops.h:11,
from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
from drivers/staging/rtl8723bs/include/drv_types.h:17,
from drivers/staging/rtl8723bs/core/rtw_security.c:8:
include/uapi/linux/byteorder/big_endian.h:38: note: this is the location of the previous definition
38 | #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
|
In file included from include/linux/byteorder/little_endian.h:5,
from drivers/staging/rtl8723bs/core/rtw_security.c:11:
include/uapi/linux/byteorder/little_endian.h:39: warning: "__cpu_to_be32" redefined
39 | #define __cpu_to_be32(x) ((__force __be32)__swab32((x)))
| In file included from include/linux/byteorder/big_endian.h:5,
from arch/parisc/include/uapi/asm/byteorder.h:5, from arch/parisc/include/asm/bitops.h:11, from include/linux/bitops.h:32,
from include/linux/kernel.h:12,
from include/linux/list.h:9,
from include/linux/rculist.h:10,
from include/linux/sched/signal.h:5,
vim +/__cpu_to_le64p +44 include/uapi/linux/byteorder/little_endian.h
5921e6f8809b16 David Howells 2012-10-13 14
5921e6f8809b16 David Howells 2012-10-13 @15 #define __constant_htonl(x) ((__force __be32)___constant_swab32((x)))
5921e6f8809b16 David Howells 2012-10-13 @16 #define __constant_ntohl(x) ___constant_swab32((__force __be32)(x))
5921e6f8809b16 David Howells 2012-10-13 @17 #define __constant_htons(x) ((__force __be16)___constant_swab16((x)))
5921e6f8809b16 David Howells 2012-10-13 @18 #define __constant_ntohs(x) ___constant_swab16((__force __be16)(x))
5921e6f8809b16 David Howells 2012-10-13 @19 #define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x))
5921e6f8809b16 David Howells 2012-10-13 @20 #define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x))
5921e6f8809b16 David Howells 2012-10-13 @21 #define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x))
5921e6f8809b16 David Howells 2012-10-13 @22 #define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x))
5921e6f8809b16 David Howells 2012-10-13 @23 #define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x))
5921e6f8809b16 David Howells 2012-10-13 @24 #define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x))
5921e6f8809b16 David Howells 2012-10-13 @25 #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x)))
5921e6f8809b16 David Howells 2012-10-13 @26 #define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x))
5921e6f8809b16 David Howells 2012-10-13 @27 #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))
5921e6f8809b16 David Howells 2012-10-13 @28 #define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x))
5921e6f8809b16 David Howells 2012-10-13 @29 #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x)))
5921e6f8809b16 David Howells 2012-10-13 @30 #define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x))
5921e6f8809b16 David Howells 2012-10-13 @31 #define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
5921e6f8809b16 David Howells 2012-10-13 @32 #define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
5921e6f8809b16 David Howells 2012-10-13 @33 #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
5921e6f8809b16 David Howells 2012-10-13 @34 #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
5921e6f8809b16 David Howells 2012-10-13 @35 #define __cpu_to_le16(x) ((__force __le16)(__u16)(x))
5921e6f8809b16 David Howells 2012-10-13 @36 #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
5921e6f8809b16 David Howells 2012-10-13 @37 #define __cpu_to_be64(x) ((__force __be64)__swab64((x)))
5921e6f8809b16 David Howells 2012-10-13 @38 #define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
5921e6f8809b16 David Howells 2012-10-13 @39 #define __cpu_to_be32(x) ((__force __be32)__swab32((x)))
5921e6f8809b16 David Howells 2012-10-13 @40 #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
5921e6f8809b16 David Howells 2012-10-13 @41 #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
5921e6f8809b16 David Howells 2012-10-13 @42 #define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
5921e6f8809b16 David Howells 2012-10-13 43
bc27fb68aaad44 Denys Vlasenko 2016-03-17 @44 static __always_inline __le64 __cpu_to_le64p(const __u64 *p)
5921e6f8809b16 David Howells 2012-10-13 45 {
5921e6f8809b16 David Howells 2012-10-13 46 return (__force __le64)*p;
5921e6f8809b16 David Howells 2012-10-13 47 }
bc27fb68aaad44 Denys Vlasenko 2016-03-17 @48 static __always_inline __u64 __le64_to_cpup(const __le64 *p)
5921e6f8809b16 David Howells 2012-10-13 49 {
5921e6f8809b16 David Howells 2012-10-13 50 return (__force __u64)*p;
5921e6f8809b16 David Howells 2012-10-13 51 }
bc27fb68aaad44 Denys Vlasenko 2016-03-17 @52 static __always_inline __le32 __cpu_to_le32p(const __u32 *p)
5921e6f8809b16 David Howells 2012-10-13 53 {
5921e6f8809b16 David Howells 2012-10-13 54 return (__force __le32)*p;
5921e6f8809b16 David Howells 2012-10-13 55 }
bc27fb68aaad44 Denys Vlasenko 2016-03-17 @56 static __always_inline __u32 __le32_to_cpup(const __le32 *p)
5921e6f8809b16 David Howells 2012-10-13 57 {
5921e6f8809b16 David Howells 2012-10-13 58 return (__force __u32)*p;
5921e6f8809b16 David Howells 2012-10-13 59 }
bc27fb68aaad44 Denys Vlasenko 2016-03-17 @60 static __always_inline __le16 __cpu_to_le16p(const __u16 *p)
5921e6f8809b16 David Howells 2012-10-13 61 {
5921e6f8809b16 David Howells 2012-10-13 62 return (__force __le16)*p;
5921e6f8809b16 David Howells 2012-10-13 63 }
bc27fb68aaad44 Denys Vlasenko 2016-03-17 @64 static __always_inline __u16 __le16_to_cpup(const __le16 *p)
5921e6f8809b16 David Howells 2012-10-13 65 {
5921e6f8809b16 David Howells 2012-10-13 66 return (__force __u16)*p;
5921e6f8809b16 David Howells 2012-10-13 67 }
bc27fb68aaad44 Denys Vlasenko 2016-03-17 @68 static __always_inline __be64 __cpu_to_be64p(const __u64 *p)
5921e6f8809b16 David Howells 2012-10-13 69 {
5921e6f8809b16 David Howells 2012-10-13 70 return (__force __be64)__swab64p(p);
5921e6f8809b16 David Howells 2012-10-13 71 }
bc27fb68aaad44 Denys Vlasenko 2016-03-17 @72 static __always_inline __u64 __be64_to_cpup(const __be64 *p)
5921e6f8809b16 David Howells 2012-10-13 73 {
5921e6f8809b16 David Howells 2012-10-13 74 return __swab64p((__u64 *)p);
5921e6f8809b16 David Howells 2012-10-13 75 }
bc27fb68aaad44 Denys Vlasenko 2016-03-17 @76 static __always_inline __be32 __cpu_to_be32p(const __u32 *p)
5921e6f8809b16 David Howells 2012-10-13 77 {
5921e6f8809b16 David Howells 2012-10-13 78 return (__force __be32)__swab32p(p);
5921e6f8809b16 David Howells 2012-10-13 79 }
bc27fb68aaad44 Denys Vlasenko 2016-03-17 @80 static __always_inline __u32 __be32_to_cpup(const __be32 *p)
5921e6f8809b16 David Howells 2012-10-13 81 {
5921e6f8809b16 David Howells 2012-10-13 82 return __swab32p((__u32 *)p);
5921e6f8809b16 David Howells 2012-10-13 83 }
bc27fb68aaad44 Denys Vlasenko 2016-03-17 @84 static __always_inline __be16 __cpu_to_be16p(const __u16 *p)
5921e6f8809b16 David Howells 2012-10-13 85 {
5921e6f8809b16 David Howells 2012-10-13 86 return (__force __be16)__swab16p(p);
5921e6f8809b16 David Howells 2012-10-13 87 }
bc27fb68aaad44 Denys Vlasenko 2016-03-17 @88 static __always_inline __u16 __be16_to_cpup(const __be16 *p)
5921e6f8809b16 David Howells 2012-10-13 89 {
5921e6f8809b16 David Howells 2012-10-13 90 return __swab16p((__u16 *)p);
5921e6f8809b16 David Howells 2012-10-13 91 }
5921e6f8809b16 David Howells 2012-10-13 @92 #define __cpu_to_le64s(x) do { (void)(x); } while (0)
5921e6f8809b16 David Howells 2012-10-13 @93 #define __le64_to_cpus(x) do { (void)(x); } while (0)
5921e6f8809b16 David Howells 2012-10-13 @94 #define __cpu_to_le32s(x) do { (void)(x); } while (0)
5921e6f8809b16 David Howells 2012-10-13 @95 #define __le32_to_cpus(x) do { (void)(x); } while (0)
5921e6f8809b16 David Howells 2012-10-13 @96 #define __cpu_to_le16s(x) do { (void)(x); } while (0)
5921e6f8809b16 David Howells 2012-10-13 @97 #define __le16_to_cpus(x) do { (void)(x); } while (0)
5921e6f8809b16 David Howells 2012-10-13 @98 #define __cpu_to_be64s(x) __swab64s((x))
5921e6f8809b16 David Howells 2012-10-13 @99 #define __be64_to_cpus(x) __swab64s((x))
5921e6f8809b16 David Howells 2012-10-13 @100 #define __cpu_to_be32s(x) __swab32s((x))
5921e6f8809b16 David Howells 2012-10-13 @101 #define __be32_to_cpus(x) __swab32s((x))
5921e6f8809b16 David Howells 2012-10-13 @102 #define __cpu_to_be16s(x) __swab16s((x))
5921e6f8809b16 David Howells 2012-10-13 @103 #define __be16_to_cpus(x) __swab16s((x))
5921e6f8809b16 David Howells 2012-10-13 104
5921e6f8809b16 David Howells 2012-10-13 105 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH 2/2 staging: rtl8723bs: fix cast to restricted __le32
In reply to Aakash HemadriFix sparse warning:
warning: cast to restricted __le32
--- drivers/staging/rtl8723bs/core/rtw_security.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/core/rtw_security.c +2 -2
@@ -122,7 +122,7 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)arc4_crypt (ctx, payload, payload, length);/* calculate icv and compare the icv */ - *((u32 *)crc) =le32_to_cpu (~crc32_le (~0 , payload, length -4 )); + *((u32 *)crc) = ~crc32_le (~0 , payload, length -4 ); } }
@@ -621,7 +621,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)arc4_setkey (ctx, rc4key,16 );arc4_crypt (ctx, payload, payload, length); - *((u32 *)crc) =le32_to_cpu (~crc32_le (~0 , payload, length -4 )); + *((u32 *)crc) = ~crc32_le (~0 , payload, length -4 );if (crc[3 ] != payload[length -1 ] || crc[2 ] != payload[length -2 ] || crc[1 ] != payload[length -3 ] || crc[0 ] != payload[length -4 ])
Signature · 1 line
2.32.0
RE: [PATCH 2/2] staging: rtl8723bs: fix cast to restricted __le32
From: Aakash Hemadri
Quoted 4 lines
Sent: 16 August 2021 18:35
Fix sparse warning:
warning: cast to restricted__le32
How many different copies of this crappy copy are there?
Quoted 1 line
...
drivers/staging/rtl8723bs/core/rtw_security.c void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe) · line 125
Quoted 11 lines
drivers/staging/rtl8723bs/core/rtw_security.c +1
-1@@ -122,7 +122,7 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)arc4_crypt (ctx, payload, payload, length);/* calculate icv and compare the icv */ - *((u32 *)crc) =le32_to_cpu (~crc32_le (~0 , payload, length -4 )); + *((u32 *)crc) = ~crc32_le (~0 , payload, length -4 );
You've removed a byteswap which is needed on BE architectures.
drivers/staging/rtl8723bs/core/rtw_security.c u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe) · line 627
Quoted 11 lines
drivers/staging/rtl8723bs/core/rtw_security.c +1
-1} }@@ -621,7 +621,7 @@ u32 rtw_tkip_decrypt(struct adapter *padapter, u8 *precvframe)arc4_setkey (ctx, rc4key,16 );arc4_crypt (ctx, payload, payload, length); - *((u32 *)crc) =le32_to_cpu (~crc32_le (~0 , payload, length -4 )); + *((u32 *)crc) = ~crc32_le (~0 , payload, length -4 );if (crc[3 ] != payload[length -1 ] || crc[2 ] != payload[length -2 ] || crc[1 ] != payload[length -3 ] || crc[0 ] != payload[length -4 ])
As above - crc32_le() does a 'little-endian crc' but returns a host-ordered value. The (horrid) array cast means you need to store a LE value.
There are a dozen better ways to do this - I'm bored of quoting them.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Quoted 3 lines · CEST Aakash Hemadri
This patchset fixes the below sparse warnings
rtw_security.c:72:50: warning: incorrect type in assignment (different base
types)
Quoted 6 lines
rtw_security.c:72:50: expected restricted
__le32[usertype]
rtw_security.c:72:50: got unsigned int[...]
This can be applied cleanly on next-20210816, and is compile tested.
This warnings have been fixed time ago against staging-testing:
please see commit aef1c966a364.
Thanks,
Fabio
Quoted 9 lines
Please ignore the duplicate of this patchset, I did not CC staging. Message ID: <[email protected]>
Aakash Hemadri (2):
staging: rtl8732bs: incorrect type in assignment
staging: rtl8723bs: cast to restricted__le32drivers/staging/rtl8723bs/core/rtw_security.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
Quoted 7 lines · CEST Fabio M. De Francesco
Quoted 4 lines · CEST Aakash Hemadri
This patchset fixes the below sparse warnings
[...]
This warnings have been fixed time ago against staging-testing:
please see commitaef1c966a364.
Hi Aakash,
I see at least two of your messages never made it to linux-staging list because the address is incorrect (you did not write in CC [email protected], instead you used the nonexistent [email protected]):
https://lore.kernel.org/lkml/[email protected]/
https://lore.kernel.org/lkml/[email protected]/
Please, send them again to the correct address.
Thanks,
Fabio