Skip to contentSkip to conversation

mac80211: determine chandef from HE 6 GHz operation

bug report Dan Carpenter 1 participant 1 message Jun 3, 2020

lore
Share & tools
lore
#0 lore raw

Hello Johannes Berg,

The patch 57fa5e85d53c: "mac80211: determine chandef from HE 6 GHz operation" from May 28, 2020, leads to the following static checker warning:

	net/mac80211/mlme.c:302 ieee80211_determine_chantype()
	error: uninitialized symbol 'ret'.

net/mac80211/mlme.c
144 static u32
145 ieee80211_determine_chantype(struct ieee80211_sub_if_data *sdata,

   146                               struct ieee80211_supported_band *sband,
   147                               struct ieee80211_channel *channel,
   148                               u32 vht_cap_info,
   149                               const struct ieee80211_ht_operation *ht_oper,
   150                               const struct ieee80211_vht_operation *vht_oper,
   151                               const struct ieee80211_he_operation *he_oper,
   152                               struct cfg80211_chan_def *chandef, bool tracking)
   153  {
   154          struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
   155          struct cfg80211_chan_def vht_chandef;
   156          struct ieee80211_sta_ht_cap sta_ht_cap;
   157          u32 ht_cfreq, ret;
   158  
   159          memset(chandef, 0, sizeof(struct cfg80211_chan_def));
   160          chandef->chan = channel;
   161          chandef->width = NL80211_CHAN_WIDTH_20_NOHT;
   162          chandef->center_freq1 = channel->center_freq;
   163          chandef->freq1_offset = channel->freq_offset;

164
165 if (channel->band == NL80211_BAND_6GHZ) {
166 if (!ieee80211_chandef_he_6ghz_oper(sdata, he_oper, chandef))
167 ret = IEEE80211_STA_DISABLE_HT |
168 IEEE80211_STA_DISABLE_VHT |
169 IEEE80211_STA_DISABLE_HE;

ret not initialized on else path.

   170                  vht_chandef = *chandef;
   171                  goto out;
                        ^^^^^^^^

   172          }
   173  
   174          memcpy(&sta_ht_cap, &sband->ht_cap, sizeof(sta_ht_cap));
   175          ieee80211_apply_htcap_overrides(sdata, &sta_ht_cap);

[ snip ]

279 ret = 0;
280
281 out:
282 /*

   283           * When tracking the current AP, don't do any further checks if the
   284           * new chandef is identical to the one we're currently using for the
   285           * connection. This keeps us from playing ping-pong with regulatory,
   286           * without it the following can happen (for example):
   287           *  - connect to an AP with 80 MHz, world regdom allows 80 MHz
   288           *  - AP advertises regdom US
   289           *  - CRDA loads regdom US with 80 MHz prohibited (old database)
   290           *  - the code below detects an unsupported channel, downgrades, and
   291           *    we disconnect from the AP in the caller
   292           *  - disconnect causes CRDA to reload world regdomain and the game
   293           *    starts anew.
   294           * (see https://bugzilla.kernel.org/show_bug.cgi?id=70881)
   295           *
   296           * It seems possible that there are still scenarios with CSA or real
   297           * bandwidth changes where a this could happen, but those cases are
   298           * less common and wouldn't completely prevent using the AP.
   299           */
   300          if (tracking &&
   301              cfg80211_chandef_identical(chandef, &sdata->vif.bss_conf.chandef))
   302                  return ret;
                        ^^^^^^^^^^

303
304 /* don't print the message below for VHT mismatch if VHT is disabled */
305 if (ret & IEEE80211_STA_DISABLE_VHT)
306 vht_chandef = *chandef;

regards,
dan carpenter