[ath:ath12k-split-phy 81/139] net/mac80211/link.c:96 ieee80211_link_init() warn: can 'master' even be NULL?
Dan Carpenter
dan.carpenter at linaro.org
Wed Mar 5 22:33:40 PST 2025
tree: https://git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git ath12k-split-phy
head: 64723c7be2b959dde8f4a8c85401a57d8740af10
commit: 139c21bdb8c36a8ad201b71678b0d1168856d5d3 [81/139] wifi: mac80211: Create separate links for VLAN interfaces
config: x86_64-randconfig-161-20250306 (https://download.01.org/0day-ci/archive/20250306/202503060854.5cPgdKzO-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
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 at intel.com>
| Reported-by: Dan Carpenter <dan.carpenter at linaro.org>
| Closes: https://lore.kernel.org/r/202503060854.5cPgdKzO-lkp@intel.com/
smatch warnings:
net/mac80211/link.c:96 ieee80211_link_init() warn: can 'master' even be NULL?
vim +/master +96 net/mac80211/link.c
e73b5e51a05d41 Johannes Berg 2022-09-02 77 void ieee80211_link_init(struct ieee80211_sub_if_data *sdata,
e73b5e51a05d41 Johannes Berg 2022-09-02 78 int link_id,
e73b5e51a05d41 Johannes Berg 2022-09-02 79 struct ieee80211_link_data *link,
e73b5e51a05d41 Johannes Berg 2022-09-02 80 struct ieee80211_bss_conf *link_conf)
e73b5e51a05d41 Johannes Berg 2022-09-02 81 {
e73b5e51a05d41 Johannes Berg 2022-09-02 82 bool deflink = link_id < 0;
e73b5e51a05d41 Johannes Berg 2022-09-02 83
e73b5e51a05d41 Johannes Berg 2022-09-02 84 if (link_id < 0)
e73b5e51a05d41 Johannes Berg 2022-09-02 85 link_id = 0;
e73b5e51a05d41 Johannes Berg 2022-09-02 86
e73b5e51a05d41 Johannes Berg 2022-09-02 87 rcu_assign_pointer(sdata->vif.link_conf[link_id], link_conf);
e73b5e51a05d41 Johannes Berg 2022-09-02 88 rcu_assign_pointer(sdata->link[link_id], link);
e73b5e51a05d41 Johannes Berg 2022-09-02 89
139c21bdb8c36a Muna Sinada 2024-10-17 90 if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) {
139c21bdb8c36a Muna Sinada 2024-10-17 91 struct ieee80211_sub_if_data *master;
139c21bdb8c36a Muna Sinada 2024-10-17 92 struct ieee80211_bss_conf *master_conf;
139c21bdb8c36a Muna Sinada 2024-10-17 93
139c21bdb8c36a Muna Sinada 2024-10-17 94 master = container_of(sdata->bss,
139c21bdb8c36a Muna Sinada 2024-10-17 95 struct ieee80211_sub_if_data, u.ap);
139c21bdb8c36a Muna Sinada 2024-10-17 @96 if (!master)
master can't be NULL. container_of() takes "sdata->bss" and subtracts an
offset.
139c21bdb8c36a Muna Sinada 2024-10-17 97 goto skip_vlan_conf;
139c21bdb8c36a Muna Sinada 2024-10-17 98
139c21bdb8c36a Muna Sinada 2024-10-17 99 master_conf = sdata_dereference(master->vif.link_conf[link_id],
139c21bdb8c36a Muna Sinada 2024-10-17 100 master);
139c21bdb8c36a Muna Sinada 2024-10-17 101
139c21bdb8c36a Muna Sinada 2024-10-17 102 memcpy(link_conf, master_conf, sizeof(*link_conf));
139c21bdb8c36a Muna Sinada 2024-10-17 103 }
139c21bdb8c36a Muna Sinada 2024-10-17 104
139c21bdb8c36a Muna Sinada 2024-10-17 105 skip_vlan_conf:
e73b5e51a05d41 Johannes Berg 2022-09-02 106 link->sdata = sdata;
e73b5e51a05d41 Johannes Berg 2022-09-02 107 link->link_id = link_id;
e73b5e51a05d41 Johannes Berg 2022-09-02 108 link->conf = link_conf;
e73b5e51a05d41 Johannes Berg 2022-09-02 109 link_conf->link_id = link_id;
e1f113cc678703 Benjamin Berg 2023-03-01 110 link_conf->vif = &sdata->vif;
c4382d5ca1af75 Emmanuel Grumbach 2024-10-07 111 link->ap_power_level = IEEE80211_UNSET_POWER_LEVEL;
c4382d5ca1af75 Emmanuel Grumbach 2024-10-07 112 link->user_power_level = sdata->local->user_power_level;
c4382d5ca1af75 Emmanuel Grumbach 2024-10-07 113 link_conf->txpower = INT_MIN;
e73b5e51a05d41 Johannes Berg 2022-09-02 114
344d18cec23142 Johannes Berg 2024-05-06 115 wiphy_work_init(&link->csa.finalize_work,
e73b5e51a05d41 Johannes Berg 2022-09-02 116 ieee80211_csa_finalize_work);
b38579aeb5b04f Johannes Berg 2023-08-28 117 wiphy_work_init(&link->color_change_finalize_work,
e73b5e51a05d41 Johannes Berg 2022-09-02 118 ieee80211_color_change_finalize_work);
4cc6f3e5e5765a Remi Pommarel 2024-09-24 119 wiphy_delayed_work_init(&link->color_collision_detect_work,
9288188438d85e Lorenzo Bianconi 2023-01-25 120 ieee80211_color_collision_detection_work);
e73b5e51a05d41 Johannes Berg 2022-09-02 121 INIT_LIST_HEAD(&link->assigned_chanctx_list);
e73b5e51a05d41 Johannes Berg 2022-09-02 122 INIT_LIST_HEAD(&link->reserved_chanctx_list);
6241d79f004329 Aditya Kumar Singh 2024-09-06 123 wiphy_delayed_work_init(&link->dfs_cac_timer_work,
6241d79f004329 Aditya Kumar Singh 2024-09-06 124 ieee80211_dfs_cac_timer_work);
e73b5e51a05d41 Johannes Berg 2022-09-02 125
e73b5e51a05d41 Johannes Berg 2022-09-02 126 if (!deflink) {
e73b5e51a05d41 Johannes Berg 2022-09-02 127 switch (sdata->vif.type) {
e73b5e51a05d41 Johannes Berg 2022-09-02 128 case NL80211_IFTYPE_AP:
139c21bdb8c36a Muna Sinada 2024-10-17 129 case NL80211_IFTYPE_AP_VLAN:
e73b5e51a05d41 Johannes Berg 2022-09-02 130 ether_addr_copy(link_conf->addr,
e73b5e51a05d41 Johannes Berg 2022-09-02 131 sdata->wdev.links[link_id].addr);
e73b5e51a05d41 Johannes Berg 2022-09-02 132 link_conf->bssid = link_conf->addr;
e73b5e51a05d41 Johannes Berg 2022-09-02 133 WARN_ON(!(sdata->wdev.valid_links & BIT(link_id)));
e73b5e51a05d41 Johannes Berg 2022-09-02 134 break;
e73b5e51a05d41 Johannes Berg 2022-09-02 135 case NL80211_IFTYPE_STATION:
e73b5e51a05d41 Johannes Berg 2022-09-02 136 /* station sets the bssid in ieee80211_mgd_setup_link */
e73b5e51a05d41 Johannes Berg 2022-09-02 137 break;
e73b5e51a05d41 Johannes Berg 2022-09-02 138 default:
e73b5e51a05d41 Johannes Berg 2022-09-02 139 WARN_ON(1);
e73b5e51a05d41 Johannes Berg 2022-09-02 140 }
170cd6a66d9a16 Benjamin Berg 2023-03-01 141
170cd6a66d9a16 Benjamin Berg 2023-03-01 142 ieee80211_link_debugfs_add(link);
e73b5e51a05d41 Johannes Berg 2022-09-02 143 }
e73b5e51a05d41 Johannes Berg 2022-09-02 144 }
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the ath12k
mailing list