All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [mac80211:master 9/9] net/mac80211/spectmgmt.c:147:42: sparse: sparse: incorrect type in initializer (different base types)
Date: Mon, 18 Jan 2021 18:36:11 +0800	[thread overview]
Message-ID: <202101181806.ShYICAB2-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 8142 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git master
head:   8b194febe111c5cc47595749a766d24ca33dd95a
commit: 8b194febe111c5cc47595749a766d24ca33dd95a [9/9] mac80211: 160MHz with extended NSS BW in CSA
config: i386-randconfig-s002-20210118 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-208-g46a52ca4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git/commit/?id=8b194febe111c5cc47595749a766d24ca33dd95a
        git remote add mac80211 https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git
        git fetch --no-tags mac80211 master
        git checkout 8b194febe111c5cc47595749a766d24ca33dd95a
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


"sparse warnings: (new ones prefixed by >>)"
>> net/mac80211/spectmgmt.c:147:42: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le16 [usertype] operation_mode @@     got int @@
   net/mac80211/spectmgmt.c:147:42: sparse:     expected restricted __le16 [usertype] operation_mode
   net/mac80211/spectmgmt.c:147:42: sparse:     got int

vim +147 net/mac80211/spectmgmt.c

    21	
    22	int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
    23					 struct ieee802_11_elems *elems,
    24					 enum nl80211_band current_band,
    25					 u32 vht_cap_info,
    26					 u32 sta_flags, u8 *bssid,
    27					 struct ieee80211_csa_ie *csa_ie)
    28	{
    29		enum nl80211_band new_band = current_band;
    30		int new_freq;
    31		u8 new_chan_no;
    32		struct ieee80211_channel *new_chan;
    33		struct cfg80211_chan_def new_vht_chandef = {};
    34		const struct ieee80211_sec_chan_offs_ie *sec_chan_offs;
    35		const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie;
    36		int secondary_channel_offset = -1;
    37	
    38		memset(csa_ie, 0, sizeof(*csa_ie));
    39	
    40		sec_chan_offs = elems->sec_chan_offs;
    41		wide_bw_chansw_ie = elems->wide_bw_chansw_ie;
    42	
    43		if (sta_flags & (IEEE80211_STA_DISABLE_HT |
    44				 IEEE80211_STA_DISABLE_40MHZ)) {
    45			sec_chan_offs = NULL;
    46			wide_bw_chansw_ie = NULL;
    47		}
    48	
    49		if (sta_flags & IEEE80211_STA_DISABLE_VHT)
    50			wide_bw_chansw_ie = NULL;
    51	
    52		if (elems->ext_chansw_ie) {
    53			if (!ieee80211_operating_class_to_band(
    54					elems->ext_chansw_ie->new_operating_class,
    55					&new_band)) {
    56				sdata_info(sdata,
    57					   "cannot understand ECSA IE operating class, %d, ignoring\n",
    58					   elems->ext_chansw_ie->new_operating_class);
    59			}
    60			new_chan_no = elems->ext_chansw_ie->new_ch_num;
    61			csa_ie->count = elems->ext_chansw_ie->count;
    62			csa_ie->mode = elems->ext_chansw_ie->mode;
    63		} else if (elems->ch_switch_ie) {
    64			new_chan_no = elems->ch_switch_ie->new_ch_num;
    65			csa_ie->count = elems->ch_switch_ie->count;
    66			csa_ie->mode = elems->ch_switch_ie->mode;
    67		} else {
    68			/* nothing here we understand */
    69			return 1;
    70		}
    71	
    72		/* Mesh Channel Switch Parameters Element */
    73		if (elems->mesh_chansw_params_ie) {
    74			csa_ie->ttl = elems->mesh_chansw_params_ie->mesh_ttl;
    75			csa_ie->mode = elems->mesh_chansw_params_ie->mesh_flags;
    76			csa_ie->pre_value = le16_to_cpu(
    77					elems->mesh_chansw_params_ie->mesh_pre_value);
    78	
    79			if (elems->mesh_chansw_params_ie->mesh_flags &
    80					WLAN_EID_CHAN_SWITCH_PARAM_REASON)
    81				csa_ie->reason_code = le16_to_cpu(
    82					elems->mesh_chansw_params_ie->mesh_reason);
    83		}
    84	
    85		new_freq = ieee80211_channel_to_frequency(new_chan_no, new_band);
    86		new_chan = ieee80211_get_channel(sdata->local->hw.wiphy, new_freq);
    87		if (!new_chan || new_chan->flags & IEEE80211_CHAN_DISABLED) {
    88			sdata_info(sdata,
    89				   "BSS %pM switches to unsupported channel (%d MHz), disconnecting\n",
    90				   bssid, new_freq);
    91			return -EINVAL;
    92		}
    93	
    94		if (sec_chan_offs) {
    95			secondary_channel_offset = sec_chan_offs->sec_chan_offs;
    96		} else if (!(sta_flags & IEEE80211_STA_DISABLE_HT)) {
    97			/* If the secondary channel offset IE is not present,
    98			 * we can't know what's the post-CSA offset, so the
    99			 * best we can do is use 20MHz.
   100			*/
   101			secondary_channel_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE;
   102		}
   103	
   104		switch (secondary_channel_offset) {
   105		default:
   106			/* secondary_channel_offset was present but is invalid */
   107		case IEEE80211_HT_PARAM_CHA_SEC_NONE:
   108			cfg80211_chandef_create(&csa_ie->chandef, new_chan,
   109						NL80211_CHAN_HT20);
   110			break;
   111		case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
   112			cfg80211_chandef_create(&csa_ie->chandef, new_chan,
   113						NL80211_CHAN_HT40PLUS);
   114			break;
   115		case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
   116			cfg80211_chandef_create(&csa_ie->chandef, new_chan,
   117						NL80211_CHAN_HT40MINUS);
   118			break;
   119		case -1:
   120			cfg80211_chandef_create(&csa_ie->chandef, new_chan,
   121						NL80211_CHAN_NO_HT);
   122			/* keep width for 5/10 MHz channels */
   123			switch (sdata->vif.bss_conf.chandef.width) {
   124			case NL80211_CHAN_WIDTH_5:
   125			case NL80211_CHAN_WIDTH_10:
   126				csa_ie->chandef.width =
   127					sdata->vif.bss_conf.chandef.width;
   128				break;
   129			default:
   130				break;
   131			}
   132			break;
   133		}
   134	
   135		if (wide_bw_chansw_ie) {
   136			u8 new_seg1 = wide_bw_chansw_ie->new_center_freq_seg1;
   137			struct ieee80211_vht_operation vht_oper = {
   138				.chan_width =
   139					wide_bw_chansw_ie->new_channel_width,
   140				.center_freq_seg0_idx =
   141					wide_bw_chansw_ie->new_center_freq_seg0,
   142				.center_freq_seg1_idx = new_seg1,
   143				/* .basic_mcs_set doesn't matter */
   144			};
   145			struct ieee80211_ht_operation ht_oper = {
   146				.operation_mode =
 > 147					new_seg1 << IEEE80211_HT_OP_MODE_CCFS2_SHIFT,
   148			};
   149	
   150			/* default, for the case of IEEE80211_VHT_CHANWIDTH_USE_HT,
   151			 * to the previously parsed chandef
   152			 */
   153			new_vht_chandef = csa_ie->chandef;
   154	
   155			/* ignore if parsing fails */
   156			if (!ieee80211_chandef_vht_oper(&sdata->local->hw,
   157							vht_cap_info,
   158							&vht_oper, &ht_oper,
   159							&new_vht_chandef))
   160				new_vht_chandef.chan = NULL;
   161	
   162			if (sta_flags & IEEE80211_STA_DISABLE_80P80MHZ &&
   163			    new_vht_chandef.width == NL80211_CHAN_WIDTH_80P80)
   164				ieee80211_chandef_downgrade(&new_vht_chandef);
   165			if (sta_flags & IEEE80211_STA_DISABLE_160MHZ &&
   166			    new_vht_chandef.width == NL80211_CHAN_WIDTH_160)
   167				ieee80211_chandef_downgrade(&new_vht_chandef);
   168		}
   169	
   170		/* if VHT data is there validate & use it */
   171		if (new_vht_chandef.chan) {
   172			if (!cfg80211_chandef_compatible(&new_vht_chandef,
   173							 &csa_ie->chandef)) {
   174				sdata_info(sdata,
   175					   "BSS %pM: CSA has inconsistent channel data, disconnecting\n",
   176					   bssid);
   177				return -EINVAL;
   178			}
   179			csa_ie->chandef = new_vht_chandef;
   180		}
   181	
   182		if (elems->max_channel_switch_time)
   183			csa_ie->max_switch_time =
   184				(elems->max_channel_switch_time[0] << 0) |
   185				(elems->max_channel_switch_time[1] <<  8) |
   186				(elems->max_channel_switch_time[2] << 16);
   187	
   188		return 0;
   189	}
   190	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 49149 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Shay Bar <shay.bar@celeno.com>
Cc: kbuild-all@lists.01.org, linux-wireless@vger.kernel.org,
	Johannes Berg <johannes.berg@intel.com>,
	Aviad Brikman <aviad.brikman@celeno.com>
Subject: [mac80211:master 9/9] net/mac80211/spectmgmt.c:147:42: sparse: sparse: incorrect type in initializer (different base types)
Date: Mon, 18 Jan 2021 18:36:11 +0800	[thread overview]
Message-ID: <202101181806.ShYICAB2-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 7942 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git master
head:   8b194febe111c5cc47595749a766d24ca33dd95a
commit: 8b194febe111c5cc47595749a766d24ca33dd95a [9/9] mac80211: 160MHz with extended NSS BW in CSA
config: i386-randconfig-s002-20210118 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-208-g46a52ca4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git/commit/?id=8b194febe111c5cc47595749a766d24ca33dd95a
        git remote add mac80211 https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211.git
        git fetch --no-tags mac80211 master
        git checkout 8b194febe111c5cc47595749a766d24ca33dd95a
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


"sparse warnings: (new ones prefixed by >>)"
>> net/mac80211/spectmgmt.c:147:42: sparse: sparse: incorrect type in initializer (different base types) @@     expected restricted __le16 [usertype] operation_mode @@     got int @@
   net/mac80211/spectmgmt.c:147:42: sparse:     expected restricted __le16 [usertype] operation_mode
   net/mac80211/spectmgmt.c:147:42: sparse:     got int

vim +147 net/mac80211/spectmgmt.c

    21	
    22	int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
    23					 struct ieee802_11_elems *elems,
    24					 enum nl80211_band current_band,
    25					 u32 vht_cap_info,
    26					 u32 sta_flags, u8 *bssid,
    27					 struct ieee80211_csa_ie *csa_ie)
    28	{
    29		enum nl80211_band new_band = current_band;
    30		int new_freq;
    31		u8 new_chan_no;
    32		struct ieee80211_channel *new_chan;
    33		struct cfg80211_chan_def new_vht_chandef = {};
    34		const struct ieee80211_sec_chan_offs_ie *sec_chan_offs;
    35		const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie;
    36		int secondary_channel_offset = -1;
    37	
    38		memset(csa_ie, 0, sizeof(*csa_ie));
    39	
    40		sec_chan_offs = elems->sec_chan_offs;
    41		wide_bw_chansw_ie = elems->wide_bw_chansw_ie;
    42	
    43		if (sta_flags & (IEEE80211_STA_DISABLE_HT |
    44				 IEEE80211_STA_DISABLE_40MHZ)) {
    45			sec_chan_offs = NULL;
    46			wide_bw_chansw_ie = NULL;
    47		}
    48	
    49		if (sta_flags & IEEE80211_STA_DISABLE_VHT)
    50			wide_bw_chansw_ie = NULL;
    51	
    52		if (elems->ext_chansw_ie) {
    53			if (!ieee80211_operating_class_to_band(
    54					elems->ext_chansw_ie->new_operating_class,
    55					&new_band)) {
    56				sdata_info(sdata,
    57					   "cannot understand ECSA IE operating class, %d, ignoring\n",
    58					   elems->ext_chansw_ie->new_operating_class);
    59			}
    60			new_chan_no = elems->ext_chansw_ie->new_ch_num;
    61			csa_ie->count = elems->ext_chansw_ie->count;
    62			csa_ie->mode = elems->ext_chansw_ie->mode;
    63		} else if (elems->ch_switch_ie) {
    64			new_chan_no = elems->ch_switch_ie->new_ch_num;
    65			csa_ie->count = elems->ch_switch_ie->count;
    66			csa_ie->mode = elems->ch_switch_ie->mode;
    67		} else {
    68			/* nothing here we understand */
    69			return 1;
    70		}
    71	
    72		/* Mesh Channel Switch Parameters Element */
    73		if (elems->mesh_chansw_params_ie) {
    74			csa_ie->ttl = elems->mesh_chansw_params_ie->mesh_ttl;
    75			csa_ie->mode = elems->mesh_chansw_params_ie->mesh_flags;
    76			csa_ie->pre_value = le16_to_cpu(
    77					elems->mesh_chansw_params_ie->mesh_pre_value);
    78	
    79			if (elems->mesh_chansw_params_ie->mesh_flags &
    80					WLAN_EID_CHAN_SWITCH_PARAM_REASON)
    81				csa_ie->reason_code = le16_to_cpu(
    82					elems->mesh_chansw_params_ie->mesh_reason);
    83		}
    84	
    85		new_freq = ieee80211_channel_to_frequency(new_chan_no, new_band);
    86		new_chan = ieee80211_get_channel(sdata->local->hw.wiphy, new_freq);
    87		if (!new_chan || new_chan->flags & IEEE80211_CHAN_DISABLED) {
    88			sdata_info(sdata,
    89				   "BSS %pM switches to unsupported channel (%d MHz), disconnecting\n",
    90				   bssid, new_freq);
    91			return -EINVAL;
    92		}
    93	
    94		if (sec_chan_offs) {
    95			secondary_channel_offset = sec_chan_offs->sec_chan_offs;
    96		} else if (!(sta_flags & IEEE80211_STA_DISABLE_HT)) {
    97			/* If the secondary channel offset IE is not present,
    98			 * we can't know what's the post-CSA offset, so the
    99			 * best we can do is use 20MHz.
   100			*/
   101			secondary_channel_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE;
   102		}
   103	
   104		switch (secondary_channel_offset) {
   105		default:
   106			/* secondary_channel_offset was present but is invalid */
   107		case IEEE80211_HT_PARAM_CHA_SEC_NONE:
   108			cfg80211_chandef_create(&csa_ie->chandef, new_chan,
   109						NL80211_CHAN_HT20);
   110			break;
   111		case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
   112			cfg80211_chandef_create(&csa_ie->chandef, new_chan,
   113						NL80211_CHAN_HT40PLUS);
   114			break;
   115		case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
   116			cfg80211_chandef_create(&csa_ie->chandef, new_chan,
   117						NL80211_CHAN_HT40MINUS);
   118			break;
   119		case -1:
   120			cfg80211_chandef_create(&csa_ie->chandef, new_chan,
   121						NL80211_CHAN_NO_HT);
   122			/* keep width for 5/10 MHz channels */
   123			switch (sdata->vif.bss_conf.chandef.width) {
   124			case NL80211_CHAN_WIDTH_5:
   125			case NL80211_CHAN_WIDTH_10:
   126				csa_ie->chandef.width =
   127					sdata->vif.bss_conf.chandef.width;
   128				break;
   129			default:
   130				break;
   131			}
   132			break;
   133		}
   134	
   135		if (wide_bw_chansw_ie) {
   136			u8 new_seg1 = wide_bw_chansw_ie->new_center_freq_seg1;
   137			struct ieee80211_vht_operation vht_oper = {
   138				.chan_width =
   139					wide_bw_chansw_ie->new_channel_width,
   140				.center_freq_seg0_idx =
   141					wide_bw_chansw_ie->new_center_freq_seg0,
   142				.center_freq_seg1_idx = new_seg1,
   143				/* .basic_mcs_set doesn't matter */
   144			};
   145			struct ieee80211_ht_operation ht_oper = {
   146				.operation_mode =
 > 147					new_seg1 << IEEE80211_HT_OP_MODE_CCFS2_SHIFT,
   148			};
   149	
   150			/* default, for the case of IEEE80211_VHT_CHANWIDTH_USE_HT,
   151			 * to the previously parsed chandef
   152			 */
   153			new_vht_chandef = csa_ie->chandef;
   154	
   155			/* ignore if parsing fails */
   156			if (!ieee80211_chandef_vht_oper(&sdata->local->hw,
   157							vht_cap_info,
   158							&vht_oper, &ht_oper,
   159							&new_vht_chandef))
   160				new_vht_chandef.chan = NULL;
   161	
   162			if (sta_flags & IEEE80211_STA_DISABLE_80P80MHZ &&
   163			    new_vht_chandef.width == NL80211_CHAN_WIDTH_80P80)
   164				ieee80211_chandef_downgrade(&new_vht_chandef);
   165			if (sta_flags & IEEE80211_STA_DISABLE_160MHZ &&
   166			    new_vht_chandef.width == NL80211_CHAN_WIDTH_160)
   167				ieee80211_chandef_downgrade(&new_vht_chandef);
   168		}
   169	
   170		/* if VHT data is there validate & use it */
   171		if (new_vht_chandef.chan) {
   172			if (!cfg80211_chandef_compatible(&new_vht_chandef,
   173							 &csa_ie->chandef)) {
   174				sdata_info(sdata,
   175					   "BSS %pM: CSA has inconsistent channel data, disconnecting\n",
   176					   bssid);
   177				return -EINVAL;
   178			}
   179			csa_ie->chandef = new_vht_chandef;
   180		}
   181	
   182		if (elems->max_channel_switch_time)
   183			csa_ie->max_switch_time =
   184				(elems->max_channel_switch_time[0] << 0) |
   185				(elems->max_channel_switch_time[1] <<  8) |
   186				(elems->max_channel_switch_time[2] << 16);
   187	
   188		return 0;
   189	}
   190	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 49149 bytes --]

             reply	other threads:[~2021-01-18 10:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18 10:36 kernel test robot [this message]
2021-01-18 10:36 ` [mac80211:master 9/9] net/mac80211/spectmgmt.c:147:42: sparse: sparse: incorrect type in initializer (different base types) kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202101181806.ShYICAB2-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.