drivers/net/wireless/microchip/wilc1000/cfg80211.c:361:42: sparse: sparse: incorrect type in assignment (different base types)

kernel test robot
2023-08-28T22:58:07Z

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 727dbda16b83600379061c4ca8270ef3e2f51922
commit: c5b331d4f550fb78bf1a553b2517616a5ea913d6 wifi: wilc1000: add WPA3 SAE support
date: 1 year, 3 months ago
config: i386-randconfig-063-20230829 (https://download.01.org/0day-ci/archive/20230829/202308290615.lUTIgqUl-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230829/202308290615.lUTIgqUl-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308290615.lUTIgqUl-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/net/wireless/microchip/wilc1000/cfg80211.c:361:42: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int key_mgmt_suite @@ got restricted __be32 [usertype] @@
drivers/net/wireless/microchip/wilc1000/cfg80211.c:361:42: sparse: expected unsigned int key_mgmt_suite
drivers/net/wireless/microchip/wilc1000/cfg80211.c:361:42: sparse: got restricted __be32 [usertype]

vim +361 drivers/net/wireless/microchip/wilc1000/cfg80211.c

300
301 static int connect(struct wiphy *wiphy, struct net_device *dev,
302 struct cfg80211_connect_params *sme)
303 {
304 struct wilc_vif *vif = netdev_priv(dev);
305 struct wilc_priv *priv = &vif->priv;
306 struct host_if_drv *wfi_drv = priv->hif_drv;
307 int ret;
308 u32 i;
309 u8 security = WILC_FW_SEC_NO;
310 enum authtype auth_type = WILC_FW_AUTH_ANY;
311 u32 cipher_group;
312 struct cfg80211_bss *bss;
313 void *join_params;
314 u8 ch;
315
316 vif->connecting = true;
317
318 cipher_group = sme->crypto.cipher_group;
319 if (cipher_group != 0) {
320 if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2) {
321 if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
322 security = WILC_FW_SEC_WPA2_TKIP;
323 else
324 security = WILC_FW_SEC_WPA2_AES;
325 } else if (sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) {
326 if (cipher_group == WLAN_CIPHER_SUITE_TKIP)
327 security = WILC_FW_SEC_WPA_TKIP;
328 else
329 security = WILC_FW_SEC_WPA_AES;
330 } else {
331 ret = -ENOTSUPP;
332 netdev_err(dev, "%s: Unsupported cipher\n",
333 __func__);
334 goto out_error;
335 }
336 }
337
338 if ((sme->crypto.wpa_versions & NL80211_WPA_VERSION_1) ||
339 (sme->crypto.wpa_versions & NL80211_WPA_VERSION_2)) {
340 for (i = 0; i < sme->crypto.n_ciphers_pairwise; i++) {
341 u32 ciphers_pairwise = sme->crypto.ciphers_pairwise[i];
342
343 if (ciphers_pairwise == WLAN_CIPHER_SUITE_TKIP)
344 security |= WILC_FW_TKIP;
345 else
346 security |= WILC_FW_AES;
347 }
348 }
349
350 switch (sme->auth_type) {
351 case NL80211_AUTHTYPE_OPEN_SYSTEM:
352 auth_type = WILC_FW_AUTH_OPEN_SYSTEM;
353 break;
354
355 case NL80211_AUTHTYPE_SAE:
356 auth_type = WILC_FW_AUTH_SAE;
357 if (sme->ssid_len) {
358 memcpy(vif->auth.ssid.ssid, sme->ssid, sme->ssid_len);
359 vif->auth.ssid.ssid_len = sme->ssid_len;
360 }
> 361 vif->auth.key_mgmt_suite = cpu_to_be32(sme->crypto.akm_suites[0]);
362 ether_addr_copy(vif->auth.bssid, sme->bssid);
363 break;
364
365 default:
366 break;
367 }
368
369 if (sme->crypto.n_akm_suites) {
370 if (sme->crypto.akm_suites[0] == WLAN_AKM_SUITE_8021X)
371 auth_type = WILC_FW_AUTH_IEEE8021;
372 else if (sme->crypto.akm_suites[0] == WLAN_AKM_SUITE_PSK_SHA256)
373 auth_type = WILC_FW_AUTH_OPEN_SYSTEM_SHA256;
374 else if (sme->crypto.akm_suites[0] == WLAN_AKM_SUITE_8021X_SHA256)
375 auth_type = WILC_FW_AUTH_IEE8021X_SHA256;
376 }
377
378 if (wfi_drv->usr_scan_req.scan_result) {
379 netdev_err(vif->ndev, "%s: Scan in progress\n", __func__);
380 ret = -EBUSY;
381 goto out_error;
382 }
383
384 bss = cfg80211_get_bss(wiphy, sme->channel, sme->bssid, sme->ssid,
385 sme->ssid_len, IEEE80211_BSS_TYPE_ANY,
386 IEEE80211_PRIVACY(sme->privacy));
387 if (!bss) {
388 ret = -EINVAL;
389 goto out_error;
390 }
391
392 if (ether_addr_equal_unaligned(vif->bssid, bss->bssid)) {
393 ret = -EALREADY;
394 goto out_put_bss;
395 }
396
397 join_params = wilc_parse_join_bss_param(bss, &sme->crypto);
398 if (!join_params) {
399 netdev_err(dev, "%s: failed to construct join param\n",
400 __func__);
401 ret = -EINVAL;
402 goto out_put_bss;
403 }
404
405 ch = ieee80211_frequency_to_channel(bss->channel->center_freq);
406 vif->wilc->op_ch = ch;
407 if (vif->iftype != WILC_CLIENT_MODE)
408 vif->wilc->sta_ch = ch;
409
410 wilc_wlan_set_bssid(dev, bss->bssid, WILC_STATION_MODE);
411
412 wfi_drv->conn_info.security = security;
413 wfi_drv->conn_info.auth_type = auth_type;
414 wfi_drv->conn_info.ch = ch;
415 wfi_drv->conn_info.conn_result = cfg_connect_result;
416 wfi_drv->conn_info.arg = priv;
417 wfi_drv->conn_info.param = join_params;
418
419 ret = wilc_set_join_req(vif, bss->bssid, sme->ie, sme->ie_len);
420 if (ret) {
421 netdev_err(dev, "wilc_set_join_req(): Error\n");
422 ret = -ENOENT;
423 if (vif->iftype != WILC_CLIENT_MODE)
424 vif->wilc->sta_ch = WILC_INVALID_CHANNEL;
425 wilc_wlan_set_bssid(dev, NULL, WILC_STATION_MODE);
426 wfi_drv->conn_info.conn_result = NULL;
427 kfree(join_params);
428 goto out_put_bss;
429 }
430 kfree(join_params);
431 vif->bss = bss;
432 cfg80211_put_bss(wiphy, bss);
433 return 0;
434
435 out_put_bss:
436 cfg80211_put_bss(wiphy, bss);
437
438 out_error:
439 vif->connecting = false;
440 return ret;
441 }
442

--
0-DAY CI Kernel Test Service