[asahilinux:bits/080-wifi 20/28] drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:1087:28: sparse: sparse: incorrect type in assignment (different base types)
From: kernel test robot
Date: Tue May 03 2022 - 04:08:47 EST
tree: https://github.com/AsahiLinux/linux bits/080-wifi
head: a61fbffc5fad05fe49dfd9a09b3c2482ac250d46
commit: 3535383eee14ca31f15355d05d4bcec4ae9ae09b [20/28] brcmfmac: cfg80211: Add support for scan params v2
config: mips-randconfig-s032-20220501 (https://download.01.org/0day-ci/archive/20220503/202205031618.zjvgzw7q-lkp@xxxxxxxxx/config)
compiler: mipsel-linux-gcc (GCC) 11.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/AsahiLinux/linux/commit/3535383eee14ca31f15355d05d4bcec4ae9ae09b
git remote add asahilinux https://github.com/AsahiLinux/linux
git fetch --no-tags asahilinux bits/080-wifi
git checkout 3535383eee14ca31f15355d05d4bcec4ae9ae09b
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash drivers/net/wireless/broadcom/brcm80211/brcmfmac/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
command-line: note: in included file:
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
builtin:0:0: sparse: this was the original definition
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:1087:28: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le16 [usertype] version @@ got int @@
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:1087:28: sparse: expected restricted __le16 [usertype] version
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:1087:28: sparse: got int
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:1149:38: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] scan_type @@ got int @@
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:1149:38: sparse: expected restricted __le32 [usertype] scan_type
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:1149:38: sparse: got int
>> drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:790:30: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned char [usertype] scan_type @@ got restricted __le32 [usertype] scan_type @@
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:790:30: sparse: expected unsigned char [usertype] scan_type
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:790:30: sparse: got restricted __le32 [usertype] scan_type
vim +1087 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
1069
1070 static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
1071 struct brcmf_scan_params_v2_le *params_le,
1072 struct cfg80211_scan_request *request)
1073 {
1074 u32 n_ssids;
1075 u32 n_channels;
1076 s32 i;
1077 s32 offset;
1078 u16 chanspec;
1079 char *ptr;
1080 int length;
1081 struct brcmf_ssid_le ssid_le;
1082
1083 eth_broadcast_addr(params_le->bssid);
1084
1085 length = BRCMF_SCAN_PARAMS_V2_FIXED_SIZE;
1086
> 1087 params_le->version = BRCMF_SCAN_PARAMS_VERSION_V2;
1088 params_le->bss_type = DOT11_BSSTYPE_ANY;
1089 params_le->scan_type = BRCMF_SCANTYPE_ACTIVE;
1090 params_le->channel_num = 0;
1091 params_le->nprobes = cpu_to_le32(-1);
1092 params_le->active_time = cpu_to_le32(-1);
1093 params_le->passive_time = cpu_to_le32(-1);
1094 params_le->home_time = cpu_to_le32(-1);
1095 memset(¶ms_le->ssid_le, 0, sizeof(params_le->ssid_le));
1096
1097 /* Scan abort */
1098 if (!request) {
1099 length += sizeof(u16);
1100 params_le->channel_num = cpu_to_le32(1);
1101 params_le->channel_list[0] = cpu_to_le16(-1);
1102 params_le->length = cpu_to_le16(length);
1103 return;
1104 }
1105
1106 n_ssids = request->n_ssids;
1107 n_channels = request->n_channels;
1108
1109 /* Copy channel array if applicable */
1110 brcmf_dbg(SCAN, "### List of channelspecs to scan ### %d\n",
1111 n_channels);
1112 if (n_channels > 0) {
1113 length += roundup(sizeof(u16) * n_channels, sizeof(u32));
1114 for (i = 0; i < n_channels; i++) {
1115 chanspec = channel_to_chanspec(&cfg->d11inf,
1116 request->channels[i]);
1117 brcmf_dbg(SCAN, "Chan : %d, Channel spec: %x\n",
1118 request->channels[i]->hw_value, chanspec);
1119 params_le->channel_list[i] = cpu_to_le16(chanspec);
1120 }
1121 } else {
1122 brcmf_dbg(SCAN, "Scanning all channels\n");
1123 }
1124
1125 /* Copy ssid array if applicable */
1126 brcmf_dbg(SCAN, "### List of SSIDs to scan ### %d\n", n_ssids);
1127 if (n_ssids > 0) {
1128 offset = offsetof(struct brcmf_scan_params_v2_le, channel_list) +
1129 n_channels * sizeof(u16);
1130 offset = roundup(offset, sizeof(u32));
1131 length += sizeof(ssid_le) * n_ssids,
1132 ptr = (char *)params_le + offset;
1133 for (i = 0; i < n_ssids; i++) {
1134 memset(&ssid_le, 0, sizeof(ssid_le));
1135 ssid_le.SSID_len =
1136 cpu_to_le32(request->ssids[i].ssid_len);
1137 memcpy(ssid_le.SSID, request->ssids[i].ssid,
1138 request->ssids[i].ssid_len);
1139 if (!ssid_le.SSID_len)
1140 brcmf_dbg(SCAN, "%d: Broadcast scan\n", i);
1141 else
1142 brcmf_dbg(SCAN, "%d: scan for %.32s size=%d\n",
1143 i, ssid_le.SSID, ssid_le.SSID_len);
1144 memcpy(ptr, &ssid_le, sizeof(ssid_le));
1145 ptr += sizeof(ssid_le);
1146 }
1147 } else {
1148 brcmf_dbg(SCAN, "Performing passive scan\n");
> 1149 params_le->scan_type = BRCMF_SCANTYPE_PASSIVE;
1150 }
1151 params_le->length = cpu_to_le16(length);
1152 /* Adding mask to channel numbers */
1153 params_le->channel_num =
1154 cpu_to_le32((n_ssids << BRCMF_SCAN_PARAMS_NSSID_SHIFT) |
1155 (n_channels & BRCMF_SCAN_PARAMS_COUNT_MASK));
1156 }
1157
--
0-DAY CI Kernel Test Service
https://01.org/lkp