[ammarfaizi2-block:axboe/linux-block/m1/2022-02-19 491/552] drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c:1087:28: sparse: sparse: incorrect type in assignment (different base types)
From: kernel test robot
Date: Mon Feb 21 2022 - 03:41:15 EST
tree: https://github.com/ammarfaizi2/linux-block axboe/linux-block/m1/2022-02-19
head: b781e0ccdc0c9a931571d15db09d45b7258b9905
commit: cc508fcd22b7d2522a7ace5baaf236db384f1160 [491/552] brcmfmac: cfg80211: Add support for scan params v2
config: i386-randconfig-s001-20220221 (https://download.01.org/0day-ci/archive/20220221/202202211631.TQArYv6u-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://github.com/ammarfaizi2/linux-block/commit/cc508fcd22b7d2522a7ace5baaf236db384f1160
git remote add ammarfaizi2-block https://github.com/ammarfaizi2/linux-block
git fetch --no-tags ammarfaizi2-block axboe/linux-block/m1/2022-02-19
git checkout cc508fcd22b7d2522a7ace5baaf236db384f1160
# save the config file to linux build tree
mkdir build_dir
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 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 >>)
>> 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, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx