All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Johannes Berg <johannes@sipsolutions.net>,
	linux-wireless@vger.kernel.org
Cc: kbuild-all@lists.01.org, Johannes Berg <johannes.berg@intel.com>
Subject: Re: [PATCH] nl80211: limit band information in non-split data
Date: Tue, 13 Jul 2021 06:55:18 +0800	[thread overview]
Message-ID: <202107130652.sEwRPIkh-lkp@intel.com> (raw)
In-Reply-To: <20210712215329.31444162a2c2.I5555312e4a074c84f8b4e7ad79dc4d1fbfc5126c@changeid>

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

Hi Johannes,

I love your patch! Perhaps something to improve:

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on mac80211/master v5.14-rc1 next-20210712]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Johannes-Berg/nl80211-limit-band-information-in-non-split-data/20210713-035535
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: i386-randconfig-a015-20210712 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/8b9f518558f83c5997dd9d6789623641ee5854b5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Johannes-Berg/nl80211-limit-band-information-in-non-split-data/20210713-035535
        git checkout 8b9f518558f83c5997dd9d6789623641ee5854b5
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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

All warnings (new ones prefixed by >>):

   net/wireless/nl80211.c: In function 'nl80211_send_wiphy':
>> net/wireless/nl80211.c:2355:23: warning: ?: using integer constants in boolean context, the expression will always evaluate to 'true' [-Wint-in-bool-context]
    2354 |        band < state->split ?
         |        ~~~~~~~~~~~~~~~~~~~~~
    2355 |     NUM_NL80211_BANDS :
         |     ~~~~~~~~~~~~~~~~~~^
    2356 |     NL80211_BAND_60GHZ + 1;
         |     ~~~~~~~~~~~~~~~~~~~~~~


vim +/true +2355 net/wireless/nl80211.c

  2212	
  2213	static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
  2214				      enum nl80211_commands cmd,
  2215				      struct sk_buff *msg, u32 portid, u32 seq,
  2216				      int flags, struct nl80211_dump_wiphy_state *state)
  2217	{
  2218		void *hdr;
  2219		struct nlattr *nl_bands, *nl_band;
  2220		struct nlattr *nl_freqs, *nl_freq;
  2221		struct nlattr *nl_cmds;
  2222		enum nl80211_band band;
  2223		struct ieee80211_channel *chan;
  2224		int i;
  2225		const struct ieee80211_txrx_stypes *mgmt_stypes =
  2226					rdev->wiphy.mgmt_stypes;
  2227		u32 features;
  2228	
  2229		hdr = nl80211hdr_put(msg, portid, seq, flags, cmd);
  2230		if (!hdr)
  2231			return -ENOBUFS;
  2232	
  2233		if (WARN_ON(!state))
  2234			return -EINVAL;
  2235	
  2236		if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
  2237		    nla_put_string(msg, NL80211_ATTR_WIPHY_NAME,
  2238				   wiphy_name(&rdev->wiphy)) ||
  2239		    nla_put_u32(msg, NL80211_ATTR_GENERATION,
  2240				cfg80211_rdev_list_generation))
  2241			goto nla_put_failure;
  2242	
  2243		if (cmd != NL80211_CMD_NEW_WIPHY)
  2244			goto finish;
  2245	
  2246		switch (state->split_start) {
  2247		case 0:
  2248			if (nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_SHORT,
  2249				       rdev->wiphy.retry_short) ||
  2250			    nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_LONG,
  2251				       rdev->wiphy.retry_long) ||
  2252			    nla_put_u32(msg, NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
  2253					rdev->wiphy.frag_threshold) ||
  2254			    nla_put_u32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD,
  2255					rdev->wiphy.rts_threshold) ||
  2256			    nla_put_u8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS,
  2257				       rdev->wiphy.coverage_class) ||
  2258			    nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
  2259				       rdev->wiphy.max_scan_ssids) ||
  2260			    nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS,
  2261				       rdev->wiphy.max_sched_scan_ssids) ||
  2262			    nla_put_u16(msg, NL80211_ATTR_MAX_SCAN_IE_LEN,
  2263					rdev->wiphy.max_scan_ie_len) ||
  2264			    nla_put_u16(msg, NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN,
  2265					rdev->wiphy.max_sched_scan_ie_len) ||
  2266			    nla_put_u8(msg, NL80211_ATTR_MAX_MATCH_SETS,
  2267				       rdev->wiphy.max_match_sets))
  2268				goto nla_put_failure;
  2269	
  2270			if ((rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN) &&
  2271			    nla_put_flag(msg, NL80211_ATTR_SUPPORT_IBSS_RSN))
  2272				goto nla_put_failure;
  2273			if ((rdev->wiphy.flags & WIPHY_FLAG_MESH_AUTH) &&
  2274			    nla_put_flag(msg, NL80211_ATTR_SUPPORT_MESH_AUTH))
  2275				goto nla_put_failure;
  2276			if ((rdev->wiphy.flags & WIPHY_FLAG_AP_UAPSD) &&
  2277			    nla_put_flag(msg, NL80211_ATTR_SUPPORT_AP_UAPSD))
  2278				goto nla_put_failure;
  2279			if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) &&
  2280			    nla_put_flag(msg, NL80211_ATTR_ROAM_SUPPORT))
  2281				goto nla_put_failure;
  2282			if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) &&
  2283			    nla_put_flag(msg, NL80211_ATTR_TDLS_SUPPORT))
  2284				goto nla_put_failure;
  2285			if ((rdev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP) &&
  2286			    nla_put_flag(msg, NL80211_ATTR_TDLS_EXTERNAL_SETUP))
  2287				goto nla_put_failure;
  2288			state->split_start++;
  2289			if (state->split)
  2290				break;
  2291			fallthrough;
  2292		case 1:
  2293			if (nla_put(msg, NL80211_ATTR_CIPHER_SUITES,
  2294				    sizeof(u32) * rdev->wiphy.n_cipher_suites,
  2295				    rdev->wiphy.cipher_suites))
  2296				goto nla_put_failure;
  2297	
  2298			if (nla_put_u8(msg, NL80211_ATTR_MAX_NUM_PMKIDS,
  2299				       rdev->wiphy.max_num_pmkids))
  2300				goto nla_put_failure;
  2301	
  2302			if ((rdev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) &&
  2303			    nla_put_flag(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE))
  2304				goto nla_put_failure;
  2305	
  2306			if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX,
  2307					rdev->wiphy.available_antennas_tx) ||
  2308			    nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX,
  2309					rdev->wiphy.available_antennas_rx))
  2310				goto nla_put_failure;
  2311	
  2312			if ((rdev->wiphy.flags & WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD) &&
  2313			    nla_put_u32(msg, NL80211_ATTR_PROBE_RESP_OFFLOAD,
  2314					rdev->wiphy.probe_resp_offload))
  2315				goto nla_put_failure;
  2316	
  2317			if ((rdev->wiphy.available_antennas_tx ||
  2318			     rdev->wiphy.available_antennas_rx) &&
  2319			    rdev->ops->get_antenna) {
  2320				u32 tx_ant = 0, rx_ant = 0;
  2321				int res;
  2322	
  2323				res = rdev_get_antenna(rdev, &tx_ant, &rx_ant);
  2324				if (!res) {
  2325					if (nla_put_u32(msg,
  2326							NL80211_ATTR_WIPHY_ANTENNA_TX,
  2327							tx_ant) ||
  2328					    nla_put_u32(msg,
  2329							NL80211_ATTR_WIPHY_ANTENNA_RX,
  2330							rx_ant))
  2331						goto nla_put_failure;
  2332				}
  2333			}
  2334	
  2335			state->split_start++;
  2336			if (state->split)
  2337				break;
  2338			fallthrough;
  2339		case 2:
  2340			if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES,
  2341						rdev->wiphy.interface_modes))
  2342					goto nla_put_failure;
  2343			state->split_start++;
  2344			if (state->split)
  2345				break;
  2346			fallthrough;
  2347		case 3:
  2348			nl_bands = nla_nest_start_noflag(msg,
  2349							 NL80211_ATTR_WIPHY_BANDS);
  2350			if (!nl_bands)
  2351				goto nla_put_failure;
  2352	
  2353			for (band = state->band_start;
  2354			     band < state->split ?
> 2355					NUM_NL80211_BANDS :
  2356					NL80211_BAND_60GHZ + 1;
  2357			     band++) {
  2358				struct ieee80211_supported_band *sband;
  2359	
  2360				/* omit higher bands for ancient software */
  2361				if (band > NL80211_BAND_5GHZ && !state->split)
  2362					break;
  2363	
  2364				sband = rdev->wiphy.bands[band];
  2365	
  2366				if (!sband)
  2367					continue;
  2368	
  2369				nl_band = nla_nest_start_noflag(msg, band);
  2370				if (!nl_band)
  2371					goto nla_put_failure;
  2372	
  2373				switch (state->chan_start) {
  2374				case 0:
  2375					if (nl80211_send_band_rateinfo(msg, sband,
  2376								       state->split))
  2377						goto nla_put_failure;
  2378					state->chan_start++;
  2379					if (state->split)
  2380						break;
  2381					fallthrough;
  2382				default:
  2383					/* add frequencies */
  2384					nl_freqs = nla_nest_start_noflag(msg,
  2385									 NL80211_BAND_ATTR_FREQS);
  2386					if (!nl_freqs)
  2387						goto nla_put_failure;
  2388	
  2389					for (i = state->chan_start - 1;
  2390					     i < sband->n_channels;
  2391					     i++) {
  2392						nl_freq = nla_nest_start_noflag(msg,
  2393										i);
  2394						if (!nl_freq)
  2395							goto nla_put_failure;
  2396	
  2397						chan = &sband->channels[i];
  2398	
  2399						if (nl80211_msg_put_channel(
  2400								msg, &rdev->wiphy, chan,
  2401								state->split))
  2402							goto nla_put_failure;
  2403	
  2404						nla_nest_end(msg, nl_freq);
  2405						if (state->split)
  2406							break;
  2407					}
  2408					if (i < sband->n_channels)
  2409						state->chan_start = i + 2;
  2410					else
  2411						state->chan_start = 0;
  2412					nla_nest_end(msg, nl_freqs);
  2413				}
  2414	
  2415				nla_nest_end(msg, nl_band);
  2416	
  2417				if (state->split) {
  2418					/* start again here */
  2419					if (state->chan_start)
  2420						band--;
  2421					break;
  2422				}
  2423			}
  2424			nla_nest_end(msg, nl_bands);
  2425	
  2426			if (band < NUM_NL80211_BANDS)
  2427				state->band_start = band + 1;
  2428			else
  2429				state->band_start = 0;
  2430	
  2431			/* if bands & channels are done, continue outside */
  2432			if (state->band_start == 0 && state->chan_start == 0)
  2433				state->split_start++;
  2434			if (state->split)
  2435				break;
  2436			fallthrough;
  2437		case 4:
  2438			nl_cmds = nla_nest_start_noflag(msg,
  2439							NL80211_ATTR_SUPPORTED_COMMANDS);
  2440			if (!nl_cmds)
  2441				goto nla_put_failure;
  2442	
  2443			i = nl80211_add_commands_unsplit(rdev, msg);
  2444			if (i < 0)
  2445				goto nla_put_failure;
  2446			if (state->split) {
  2447				CMD(crit_proto_start, CRIT_PROTOCOL_START);
  2448				CMD(crit_proto_stop, CRIT_PROTOCOL_STOP);
  2449				if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH)
  2450					CMD(channel_switch, CHANNEL_SWITCH);
  2451				CMD(set_qos_map, SET_QOS_MAP);
  2452				if (rdev->wiphy.features &
  2453						NL80211_FEATURE_SUPPORTS_WMM_ADMISSION)
  2454					CMD(add_tx_ts, ADD_TX_TS);
  2455				CMD(set_multicast_to_unicast, SET_MULTICAST_TO_UNICAST);
  2456				CMD(update_connect_params, UPDATE_CONNECT_PARAMS);
  2457				CMD(update_ft_ies, UPDATE_FT_IES);
  2458				if (rdev->wiphy.sar_capa)
  2459					CMD(set_sar_specs, SET_SAR_SPECS);
  2460			}
  2461	#undef CMD
  2462	
  2463			nla_nest_end(msg, nl_cmds);
  2464			state->split_start++;
  2465			if (state->split)
  2466				break;
  2467			fallthrough;
  2468		case 5:
  2469			if (rdev->ops->remain_on_channel &&
  2470			    (rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) &&
  2471			    nla_put_u32(msg,
  2472					NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION,
  2473					rdev->wiphy.max_remain_on_channel_duration))
  2474				goto nla_put_failure;
  2475	
  2476			if ((rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX) &&
  2477			    nla_put_flag(msg, NL80211_ATTR_OFFCHANNEL_TX_OK))
  2478				goto nla_put_failure;
  2479	
  2480			state->split_start++;
  2481			if (state->split)
  2482				break;
  2483			fallthrough;
  2484		case 6:
  2485	#ifdef CONFIG_PM
  2486			if (nl80211_send_wowlan(msg, rdev, state->split))
  2487				goto nla_put_failure;
  2488			state->split_start++;
  2489			if (state->split)
  2490				break;
  2491	#else
  2492			state->split_start++;
  2493	#endif
  2494			fallthrough;
  2495		case 7:
  2496			if (nl80211_put_iftypes(msg, NL80211_ATTR_SOFTWARE_IFTYPES,
  2497						rdev->wiphy.software_iftypes))
  2498				goto nla_put_failure;
  2499	
  2500			if (nl80211_put_iface_combinations(&rdev->wiphy, msg,
  2501							   state->split))
  2502				goto nla_put_failure;
  2503	
  2504			state->split_start++;
  2505			if (state->split)
  2506				break;
  2507			fallthrough;
  2508		case 8:
  2509			if ((rdev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME) &&
  2510			    nla_put_u32(msg, NL80211_ATTR_DEVICE_AP_SME,
  2511					rdev->wiphy.ap_sme_capa))
  2512				goto nla_put_failure;
  2513	
  2514			features = rdev->wiphy.features;
  2515			/*
  2516			 * We can only add the per-channel limit information if the
  2517			 * dump is split, otherwise it makes it too big. Therefore
  2518			 * only advertise it in that case.
  2519			 */
  2520			if (state->split)
  2521				features |= NL80211_FEATURE_ADVERTISE_CHAN_LIMITS;
  2522			if (nla_put_u32(msg, NL80211_ATTR_FEATURE_FLAGS, features))
  2523				goto nla_put_failure;
  2524	
  2525			if (rdev->wiphy.ht_capa_mod_mask &&
  2526			    nla_put(msg, NL80211_ATTR_HT_CAPABILITY_MASK,
  2527				    sizeof(*rdev->wiphy.ht_capa_mod_mask),
  2528				    rdev->wiphy.ht_capa_mod_mask))
  2529				goto nla_put_failure;
  2530	
  2531			if (rdev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME &&
  2532			    rdev->wiphy.max_acl_mac_addrs &&
  2533			    nla_put_u32(msg, NL80211_ATTR_MAC_ACL_MAX,
  2534					rdev->wiphy.max_acl_mac_addrs))
  2535				goto nla_put_failure;
  2536	
  2537			/*
  2538			 * Any information below this point is only available to
  2539			 * applications that can deal with it being split. This
  2540			 * helps ensure that newly added capabilities don't break
  2541			 * older tools by overrunning their buffers.
  2542			 *
  2543			 * We still increment split_start so that in the split
  2544			 * case we'll continue with more data in the next round,
  2545			 * but break unconditionally so unsplit data stops here.
  2546			 */
  2547			if (state->split)
  2548				state->split_start++;
  2549			else
  2550				state->split_start = 0;
  2551			break;
  2552		case 9:
  2553			if (nl80211_send_mgmt_stypes(msg, mgmt_stypes))
  2554				goto nla_put_failure;
  2555	
  2556			if (nla_put_u32(msg, NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS,
  2557					rdev->wiphy.max_sched_scan_plans) ||
  2558			    nla_put_u32(msg, NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL,
  2559					rdev->wiphy.max_sched_scan_plan_interval) ||
  2560			    nla_put_u32(msg, NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  2561					rdev->wiphy.max_sched_scan_plan_iterations))
  2562				goto nla_put_failure;
  2563	
  2564			if (rdev->wiphy.extended_capabilities &&
  2565			    (nla_put(msg, NL80211_ATTR_EXT_CAPA,
  2566				     rdev->wiphy.extended_capabilities_len,
  2567				     rdev->wiphy.extended_capabilities) ||
  2568			     nla_put(msg, NL80211_ATTR_EXT_CAPA_MASK,
  2569				     rdev->wiphy.extended_capabilities_len,
  2570				     rdev->wiphy.extended_capabilities_mask)))
  2571				goto nla_put_failure;
  2572	
  2573			if (rdev->wiphy.vht_capa_mod_mask &&
  2574			    nla_put(msg, NL80211_ATTR_VHT_CAPABILITY_MASK,
  2575				    sizeof(*rdev->wiphy.vht_capa_mod_mask),
  2576				    rdev->wiphy.vht_capa_mod_mask))
  2577				goto nla_put_failure;
  2578	
  2579			if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN,
  2580				    rdev->wiphy.perm_addr))
  2581				goto nla_put_failure;
  2582	
  2583			if (!is_zero_ether_addr(rdev->wiphy.addr_mask) &&
  2584			    nla_put(msg, NL80211_ATTR_MAC_MASK, ETH_ALEN,
  2585				    rdev->wiphy.addr_mask))
  2586				goto nla_put_failure;
  2587	
  2588			if (rdev->wiphy.n_addresses > 1) {
  2589				void *attr;
  2590	
  2591				attr = nla_nest_start(msg, NL80211_ATTR_MAC_ADDRS);
  2592				if (!attr)
  2593					goto nla_put_failure;
  2594	
  2595				for (i = 0; i < rdev->wiphy.n_addresses; i++)
  2596					if (nla_put(msg, i + 1, ETH_ALEN,
  2597						    rdev->wiphy.addresses[i].addr))
  2598						goto nla_put_failure;
  2599	
  2600				nla_nest_end(msg, attr);
  2601			}
  2602	
  2603			state->split_start++;
  2604			break;
  2605		case 10:
  2606			if (nl80211_send_coalesce(msg, rdev))
  2607				goto nla_put_failure;
  2608	
  2609			if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_5_10_MHZ) &&
  2610			    (nla_put_flag(msg, NL80211_ATTR_SUPPORT_5_MHZ) ||
  2611			     nla_put_flag(msg, NL80211_ATTR_SUPPORT_10_MHZ)))
  2612				goto nla_put_failure;
  2613	
  2614			if (rdev->wiphy.max_ap_assoc_sta &&
  2615			    nla_put_u32(msg, NL80211_ATTR_MAX_AP_ASSOC_STA,
  2616					rdev->wiphy.max_ap_assoc_sta))
  2617				goto nla_put_failure;
  2618	
  2619			state->split_start++;
  2620			break;
  2621		case 11:
  2622			if (rdev->wiphy.n_vendor_commands) {
  2623				const struct nl80211_vendor_cmd_info *info;
  2624				struct nlattr *nested;
  2625	
  2626				nested = nla_nest_start_noflag(msg,
  2627							       NL80211_ATTR_VENDOR_DATA);
  2628				if (!nested)
  2629					goto nla_put_failure;
  2630	
  2631				for (i = 0; i < rdev->wiphy.n_vendor_commands; i++) {
  2632					info = &rdev->wiphy.vendor_commands[i].info;
  2633					if (nla_put(msg, i + 1, sizeof(*info), info))
  2634						goto nla_put_failure;
  2635				}
  2636				nla_nest_end(msg, nested);
  2637			}
  2638	
  2639			if (rdev->wiphy.n_vendor_events) {
  2640				const struct nl80211_vendor_cmd_info *info;
  2641				struct nlattr *nested;
  2642	
  2643				nested = nla_nest_start_noflag(msg,
  2644							       NL80211_ATTR_VENDOR_EVENTS);
  2645				if (!nested)
  2646					goto nla_put_failure;
  2647	
  2648				for (i = 0; i < rdev->wiphy.n_vendor_events; i++) {
  2649					info = &rdev->wiphy.vendor_events[i];
  2650					if (nla_put(msg, i + 1, sizeof(*info), info))
  2651						goto nla_put_failure;
  2652				}
  2653				nla_nest_end(msg, nested);
  2654			}
  2655			state->split_start++;
  2656			break;
  2657		case 12:
  2658			if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH &&
  2659			    nla_put_u8(msg, NL80211_ATTR_MAX_CSA_COUNTERS,
  2660				       rdev->wiphy.max_num_csa_counters))
  2661				goto nla_put_failure;
  2662	
  2663			if (rdev->wiphy.regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED &&
  2664			    nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG))
  2665				goto nla_put_failure;
  2666	
  2667			if (rdev->wiphy.max_sched_scan_reqs &&
  2668			    nla_put_u32(msg, NL80211_ATTR_SCHED_SCAN_MAX_REQS,
  2669					rdev->wiphy.max_sched_scan_reqs))
  2670				goto nla_put_failure;
  2671	
  2672			if (nla_put(msg, NL80211_ATTR_EXT_FEATURES,
  2673				    sizeof(rdev->wiphy.ext_features),
  2674				    rdev->wiphy.ext_features))
  2675				goto nla_put_failure;
  2676	
  2677			if (rdev->wiphy.bss_select_support) {
  2678				struct nlattr *nested;
  2679				u32 bss_select_support = rdev->wiphy.bss_select_support;
  2680	
  2681				nested = nla_nest_start_noflag(msg,
  2682							       NL80211_ATTR_BSS_SELECT);
  2683				if (!nested)
  2684					goto nla_put_failure;
  2685	
  2686				i = 0;
  2687				while (bss_select_support) {
  2688					if ((bss_select_support & 1) &&
  2689					    nla_put_flag(msg, i))
  2690						goto nla_put_failure;
  2691					i++;
  2692					bss_select_support >>= 1;
  2693				}
  2694				nla_nest_end(msg, nested);
  2695			}
  2696	
  2697			state->split_start++;
  2698			break;
  2699		case 13:
  2700			if (rdev->wiphy.num_iftype_ext_capab &&
  2701			    rdev->wiphy.iftype_ext_capab) {
  2702				struct nlattr *nested_ext_capab, *nested;
  2703	
  2704				nested = nla_nest_start_noflag(msg,
  2705							       NL80211_ATTR_IFTYPE_EXT_CAPA);
  2706				if (!nested)
  2707					goto nla_put_failure;
  2708	
  2709				for (i = state->capa_start;
  2710				     i < rdev->wiphy.num_iftype_ext_capab; i++) {
  2711					const struct wiphy_iftype_ext_capab *capab;
  2712	
  2713					capab = &rdev->wiphy.iftype_ext_capab[i];
  2714	
  2715					nested_ext_capab = nla_nest_start_noflag(msg,
  2716										 i);
  2717					if (!nested_ext_capab ||
  2718					    nla_put_u32(msg, NL80211_ATTR_IFTYPE,
  2719							capab->iftype) ||
  2720					    nla_put(msg, NL80211_ATTR_EXT_CAPA,
  2721						    capab->extended_capabilities_len,
  2722						    capab->extended_capabilities) ||
  2723					    nla_put(msg, NL80211_ATTR_EXT_CAPA_MASK,
  2724						    capab->extended_capabilities_len,
  2725						    capab->extended_capabilities_mask))
  2726						goto nla_put_failure;
  2727	
  2728					nla_nest_end(msg, nested_ext_capab);
  2729					if (state->split)
  2730						break;
  2731				}
  2732				nla_nest_end(msg, nested);
  2733				if (i < rdev->wiphy.num_iftype_ext_capab) {
  2734					state->capa_start = i + 1;
  2735					break;
  2736				}
  2737			}
  2738	
  2739			if (nla_put_u32(msg, NL80211_ATTR_BANDS,
  2740					rdev->wiphy.nan_supported_bands))
  2741				goto nla_put_failure;
  2742	
  2743			if (wiphy_ext_feature_isset(&rdev->wiphy,
  2744						    NL80211_EXT_FEATURE_TXQS)) {
  2745				struct cfg80211_txq_stats txqstats = {};
  2746				int res;
  2747	
  2748				res = rdev_get_txq_stats(rdev, NULL, &txqstats);
  2749				if (!res &&
  2750				    !nl80211_put_txq_stats(msg, &txqstats,
  2751							   NL80211_ATTR_TXQ_STATS))
  2752					goto nla_put_failure;
  2753	
  2754				if (nla_put_u32(msg, NL80211_ATTR_TXQ_LIMIT,
  2755						rdev->wiphy.txq_limit))
  2756					goto nla_put_failure;
  2757				if (nla_put_u32(msg, NL80211_ATTR_TXQ_MEMORY_LIMIT,
  2758						rdev->wiphy.txq_memory_limit))
  2759					goto nla_put_failure;
  2760				if (nla_put_u32(msg, NL80211_ATTR_TXQ_QUANTUM,
  2761						rdev->wiphy.txq_quantum))
  2762					goto nla_put_failure;
  2763			}
  2764	
  2765			state->split_start++;
  2766			break;
  2767		case 14:
  2768			if (nl80211_send_pmsr_capa(rdev, msg))
  2769				goto nla_put_failure;
  2770	
  2771			state->split_start++;
  2772			break;
  2773		case 15:
  2774			if (rdev->wiphy.akm_suites &&
  2775			    nla_put(msg, NL80211_ATTR_AKM_SUITES,
  2776				    sizeof(u32) * rdev->wiphy.n_akm_suites,
  2777				    rdev->wiphy.akm_suites))
  2778				goto nla_put_failure;
  2779	
  2780			if (nl80211_put_iftype_akm_suites(rdev, msg))
  2781				goto nla_put_failure;
  2782	
  2783			if (nl80211_put_tid_config_support(rdev, msg))
  2784				goto nla_put_failure;
  2785			state->split_start++;
  2786			break;
  2787		case 16:
  2788			if (nl80211_put_sar_specs(rdev, msg))
  2789				goto nla_put_failure;
  2790	
  2791			/* done */
  2792			state->split_start = 0;
  2793			break;
  2794		}
  2795	 finish:
  2796		genlmsg_end(msg, hdr);
  2797		return 0;
  2798	
  2799	 nla_put_failure:
  2800		genlmsg_cancel(msg, hdr);
  2801		return -EMSGSIZE;
  2802	}
  2803	

---
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: 49552 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH] nl80211: limit band information in non-split data
Date: Tue, 13 Jul 2021 06:55:18 +0800	[thread overview]
Message-ID: <202107130652.sEwRPIkh-lkp@intel.com> (raw)
In-Reply-To: <20210712215329.31444162a2c2.I5555312e4a074c84f8b4e7ad79dc4d1fbfc5126c@changeid>

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

Hi Johannes,

I love your patch! Perhaps something to improve:

[auto build test WARNING on mac80211-next/master]
[also build test WARNING on mac80211/master v5.14-rc1 next-20210712]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Johannes-Berg/nl80211-limit-band-information-in-non-split-data/20210713-035535
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: i386-randconfig-a015-20210712 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/8b9f518558f83c5997dd9d6789623641ee5854b5
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Johannes-Berg/nl80211-limit-band-information-in-non-split-data/20210713-035535
        git checkout 8b9f518558f83c5997dd9d6789623641ee5854b5
        # save the attached .config to linux build tree
        make W=1 ARCH=i386 

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

All warnings (new ones prefixed by >>):

   net/wireless/nl80211.c: In function 'nl80211_send_wiphy':
>> net/wireless/nl80211.c:2355:23: warning: ?: using integer constants in boolean context, the expression will always evaluate to 'true' [-Wint-in-bool-context]
    2354 |        band < state->split ?
         |        ~~~~~~~~~~~~~~~~~~~~~
    2355 |     NUM_NL80211_BANDS :
         |     ~~~~~~~~~~~~~~~~~~^
    2356 |     NL80211_BAND_60GHZ + 1;
         |     ~~~~~~~~~~~~~~~~~~~~~~


vim +/true +2355 net/wireless/nl80211.c

  2212	
  2213	static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
  2214				      enum nl80211_commands cmd,
  2215				      struct sk_buff *msg, u32 portid, u32 seq,
  2216				      int flags, struct nl80211_dump_wiphy_state *state)
  2217	{
  2218		void *hdr;
  2219		struct nlattr *nl_bands, *nl_band;
  2220		struct nlattr *nl_freqs, *nl_freq;
  2221		struct nlattr *nl_cmds;
  2222		enum nl80211_band band;
  2223		struct ieee80211_channel *chan;
  2224		int i;
  2225		const struct ieee80211_txrx_stypes *mgmt_stypes =
  2226					rdev->wiphy.mgmt_stypes;
  2227		u32 features;
  2228	
  2229		hdr = nl80211hdr_put(msg, portid, seq, flags, cmd);
  2230		if (!hdr)
  2231			return -ENOBUFS;
  2232	
  2233		if (WARN_ON(!state))
  2234			return -EINVAL;
  2235	
  2236		if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
  2237		    nla_put_string(msg, NL80211_ATTR_WIPHY_NAME,
  2238				   wiphy_name(&rdev->wiphy)) ||
  2239		    nla_put_u32(msg, NL80211_ATTR_GENERATION,
  2240				cfg80211_rdev_list_generation))
  2241			goto nla_put_failure;
  2242	
  2243		if (cmd != NL80211_CMD_NEW_WIPHY)
  2244			goto finish;
  2245	
  2246		switch (state->split_start) {
  2247		case 0:
  2248			if (nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_SHORT,
  2249				       rdev->wiphy.retry_short) ||
  2250			    nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_LONG,
  2251				       rdev->wiphy.retry_long) ||
  2252			    nla_put_u32(msg, NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
  2253					rdev->wiphy.frag_threshold) ||
  2254			    nla_put_u32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD,
  2255					rdev->wiphy.rts_threshold) ||
  2256			    nla_put_u8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS,
  2257				       rdev->wiphy.coverage_class) ||
  2258			    nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
  2259				       rdev->wiphy.max_scan_ssids) ||
  2260			    nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS,
  2261				       rdev->wiphy.max_sched_scan_ssids) ||
  2262			    nla_put_u16(msg, NL80211_ATTR_MAX_SCAN_IE_LEN,
  2263					rdev->wiphy.max_scan_ie_len) ||
  2264			    nla_put_u16(msg, NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN,
  2265					rdev->wiphy.max_sched_scan_ie_len) ||
  2266			    nla_put_u8(msg, NL80211_ATTR_MAX_MATCH_SETS,
  2267				       rdev->wiphy.max_match_sets))
  2268				goto nla_put_failure;
  2269	
  2270			if ((rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN) &&
  2271			    nla_put_flag(msg, NL80211_ATTR_SUPPORT_IBSS_RSN))
  2272				goto nla_put_failure;
  2273			if ((rdev->wiphy.flags & WIPHY_FLAG_MESH_AUTH) &&
  2274			    nla_put_flag(msg, NL80211_ATTR_SUPPORT_MESH_AUTH))
  2275				goto nla_put_failure;
  2276			if ((rdev->wiphy.flags & WIPHY_FLAG_AP_UAPSD) &&
  2277			    nla_put_flag(msg, NL80211_ATTR_SUPPORT_AP_UAPSD))
  2278				goto nla_put_failure;
  2279			if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) &&
  2280			    nla_put_flag(msg, NL80211_ATTR_ROAM_SUPPORT))
  2281				goto nla_put_failure;
  2282			if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) &&
  2283			    nla_put_flag(msg, NL80211_ATTR_TDLS_SUPPORT))
  2284				goto nla_put_failure;
  2285			if ((rdev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP) &&
  2286			    nla_put_flag(msg, NL80211_ATTR_TDLS_EXTERNAL_SETUP))
  2287				goto nla_put_failure;
  2288			state->split_start++;
  2289			if (state->split)
  2290				break;
  2291			fallthrough;
  2292		case 1:
  2293			if (nla_put(msg, NL80211_ATTR_CIPHER_SUITES,
  2294				    sizeof(u32) * rdev->wiphy.n_cipher_suites,
  2295				    rdev->wiphy.cipher_suites))
  2296				goto nla_put_failure;
  2297	
  2298			if (nla_put_u8(msg, NL80211_ATTR_MAX_NUM_PMKIDS,
  2299				       rdev->wiphy.max_num_pmkids))
  2300				goto nla_put_failure;
  2301	
  2302			if ((rdev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) &&
  2303			    nla_put_flag(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE))
  2304				goto nla_put_failure;
  2305	
  2306			if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX,
  2307					rdev->wiphy.available_antennas_tx) ||
  2308			    nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX,
  2309					rdev->wiphy.available_antennas_rx))
  2310				goto nla_put_failure;
  2311	
  2312			if ((rdev->wiphy.flags & WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD) &&
  2313			    nla_put_u32(msg, NL80211_ATTR_PROBE_RESP_OFFLOAD,
  2314					rdev->wiphy.probe_resp_offload))
  2315				goto nla_put_failure;
  2316	
  2317			if ((rdev->wiphy.available_antennas_tx ||
  2318			     rdev->wiphy.available_antennas_rx) &&
  2319			    rdev->ops->get_antenna) {
  2320				u32 tx_ant = 0, rx_ant = 0;
  2321				int res;
  2322	
  2323				res = rdev_get_antenna(rdev, &tx_ant, &rx_ant);
  2324				if (!res) {
  2325					if (nla_put_u32(msg,
  2326							NL80211_ATTR_WIPHY_ANTENNA_TX,
  2327							tx_ant) ||
  2328					    nla_put_u32(msg,
  2329							NL80211_ATTR_WIPHY_ANTENNA_RX,
  2330							rx_ant))
  2331						goto nla_put_failure;
  2332				}
  2333			}
  2334	
  2335			state->split_start++;
  2336			if (state->split)
  2337				break;
  2338			fallthrough;
  2339		case 2:
  2340			if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES,
  2341						rdev->wiphy.interface_modes))
  2342					goto nla_put_failure;
  2343			state->split_start++;
  2344			if (state->split)
  2345				break;
  2346			fallthrough;
  2347		case 3:
  2348			nl_bands = nla_nest_start_noflag(msg,
  2349							 NL80211_ATTR_WIPHY_BANDS);
  2350			if (!nl_bands)
  2351				goto nla_put_failure;
  2352	
  2353			for (band = state->band_start;
  2354			     band < state->split ?
> 2355					NUM_NL80211_BANDS :
  2356					NL80211_BAND_60GHZ + 1;
  2357			     band++) {
  2358				struct ieee80211_supported_band *sband;
  2359	
  2360				/* omit higher bands for ancient software */
  2361				if (band > NL80211_BAND_5GHZ && !state->split)
  2362					break;
  2363	
  2364				sband = rdev->wiphy.bands[band];
  2365	
  2366				if (!sband)
  2367					continue;
  2368	
  2369				nl_band = nla_nest_start_noflag(msg, band);
  2370				if (!nl_band)
  2371					goto nla_put_failure;
  2372	
  2373				switch (state->chan_start) {
  2374				case 0:
  2375					if (nl80211_send_band_rateinfo(msg, sband,
  2376								       state->split))
  2377						goto nla_put_failure;
  2378					state->chan_start++;
  2379					if (state->split)
  2380						break;
  2381					fallthrough;
  2382				default:
  2383					/* add frequencies */
  2384					nl_freqs = nla_nest_start_noflag(msg,
  2385									 NL80211_BAND_ATTR_FREQS);
  2386					if (!nl_freqs)
  2387						goto nla_put_failure;
  2388	
  2389					for (i = state->chan_start - 1;
  2390					     i < sband->n_channels;
  2391					     i++) {
  2392						nl_freq = nla_nest_start_noflag(msg,
  2393										i);
  2394						if (!nl_freq)
  2395							goto nla_put_failure;
  2396	
  2397						chan = &sband->channels[i];
  2398	
  2399						if (nl80211_msg_put_channel(
  2400								msg, &rdev->wiphy, chan,
  2401								state->split))
  2402							goto nla_put_failure;
  2403	
  2404						nla_nest_end(msg, nl_freq);
  2405						if (state->split)
  2406							break;
  2407					}
  2408					if (i < sband->n_channels)
  2409						state->chan_start = i + 2;
  2410					else
  2411						state->chan_start = 0;
  2412					nla_nest_end(msg, nl_freqs);
  2413				}
  2414	
  2415				nla_nest_end(msg, nl_band);
  2416	
  2417				if (state->split) {
  2418					/* start again here */
  2419					if (state->chan_start)
  2420						band--;
  2421					break;
  2422				}
  2423			}
  2424			nla_nest_end(msg, nl_bands);
  2425	
  2426			if (band < NUM_NL80211_BANDS)
  2427				state->band_start = band + 1;
  2428			else
  2429				state->band_start = 0;
  2430	
  2431			/* if bands & channels are done, continue outside */
  2432			if (state->band_start == 0 && state->chan_start == 0)
  2433				state->split_start++;
  2434			if (state->split)
  2435				break;
  2436			fallthrough;
  2437		case 4:
  2438			nl_cmds = nla_nest_start_noflag(msg,
  2439							NL80211_ATTR_SUPPORTED_COMMANDS);
  2440			if (!nl_cmds)
  2441				goto nla_put_failure;
  2442	
  2443			i = nl80211_add_commands_unsplit(rdev, msg);
  2444			if (i < 0)
  2445				goto nla_put_failure;
  2446			if (state->split) {
  2447				CMD(crit_proto_start, CRIT_PROTOCOL_START);
  2448				CMD(crit_proto_stop, CRIT_PROTOCOL_STOP);
  2449				if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH)
  2450					CMD(channel_switch, CHANNEL_SWITCH);
  2451				CMD(set_qos_map, SET_QOS_MAP);
  2452				if (rdev->wiphy.features &
  2453						NL80211_FEATURE_SUPPORTS_WMM_ADMISSION)
  2454					CMD(add_tx_ts, ADD_TX_TS);
  2455				CMD(set_multicast_to_unicast, SET_MULTICAST_TO_UNICAST);
  2456				CMD(update_connect_params, UPDATE_CONNECT_PARAMS);
  2457				CMD(update_ft_ies, UPDATE_FT_IES);
  2458				if (rdev->wiphy.sar_capa)
  2459					CMD(set_sar_specs, SET_SAR_SPECS);
  2460			}
  2461	#undef CMD
  2462	
  2463			nla_nest_end(msg, nl_cmds);
  2464			state->split_start++;
  2465			if (state->split)
  2466				break;
  2467			fallthrough;
  2468		case 5:
  2469			if (rdev->ops->remain_on_channel &&
  2470			    (rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) &&
  2471			    nla_put_u32(msg,
  2472					NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION,
  2473					rdev->wiphy.max_remain_on_channel_duration))
  2474				goto nla_put_failure;
  2475	
  2476			if ((rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX) &&
  2477			    nla_put_flag(msg, NL80211_ATTR_OFFCHANNEL_TX_OK))
  2478				goto nla_put_failure;
  2479	
  2480			state->split_start++;
  2481			if (state->split)
  2482				break;
  2483			fallthrough;
  2484		case 6:
  2485	#ifdef CONFIG_PM
  2486			if (nl80211_send_wowlan(msg, rdev, state->split))
  2487				goto nla_put_failure;
  2488			state->split_start++;
  2489			if (state->split)
  2490				break;
  2491	#else
  2492			state->split_start++;
  2493	#endif
  2494			fallthrough;
  2495		case 7:
  2496			if (nl80211_put_iftypes(msg, NL80211_ATTR_SOFTWARE_IFTYPES,
  2497						rdev->wiphy.software_iftypes))
  2498				goto nla_put_failure;
  2499	
  2500			if (nl80211_put_iface_combinations(&rdev->wiphy, msg,
  2501							   state->split))
  2502				goto nla_put_failure;
  2503	
  2504			state->split_start++;
  2505			if (state->split)
  2506				break;
  2507			fallthrough;
  2508		case 8:
  2509			if ((rdev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME) &&
  2510			    nla_put_u32(msg, NL80211_ATTR_DEVICE_AP_SME,
  2511					rdev->wiphy.ap_sme_capa))
  2512				goto nla_put_failure;
  2513	
  2514			features = rdev->wiphy.features;
  2515			/*
  2516			 * We can only add the per-channel limit information if the
  2517			 * dump is split, otherwise it makes it too big. Therefore
  2518			 * only advertise it in that case.
  2519			 */
  2520			if (state->split)
  2521				features |= NL80211_FEATURE_ADVERTISE_CHAN_LIMITS;
  2522			if (nla_put_u32(msg, NL80211_ATTR_FEATURE_FLAGS, features))
  2523				goto nla_put_failure;
  2524	
  2525			if (rdev->wiphy.ht_capa_mod_mask &&
  2526			    nla_put(msg, NL80211_ATTR_HT_CAPABILITY_MASK,
  2527				    sizeof(*rdev->wiphy.ht_capa_mod_mask),
  2528				    rdev->wiphy.ht_capa_mod_mask))
  2529				goto nla_put_failure;
  2530	
  2531			if (rdev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME &&
  2532			    rdev->wiphy.max_acl_mac_addrs &&
  2533			    nla_put_u32(msg, NL80211_ATTR_MAC_ACL_MAX,
  2534					rdev->wiphy.max_acl_mac_addrs))
  2535				goto nla_put_failure;
  2536	
  2537			/*
  2538			 * Any information below this point is only available to
  2539			 * applications that can deal with it being split. This
  2540			 * helps ensure that newly added capabilities don't break
  2541			 * older tools by overrunning their buffers.
  2542			 *
  2543			 * We still increment split_start so that in the split
  2544			 * case we'll continue with more data in the next round,
  2545			 * but break unconditionally so unsplit data stops here.
  2546			 */
  2547			if (state->split)
  2548				state->split_start++;
  2549			else
  2550				state->split_start = 0;
  2551			break;
  2552		case 9:
  2553			if (nl80211_send_mgmt_stypes(msg, mgmt_stypes))
  2554				goto nla_put_failure;
  2555	
  2556			if (nla_put_u32(msg, NL80211_ATTR_MAX_NUM_SCHED_SCAN_PLANS,
  2557					rdev->wiphy.max_sched_scan_plans) ||
  2558			    nla_put_u32(msg, NL80211_ATTR_MAX_SCAN_PLAN_INTERVAL,
  2559					rdev->wiphy.max_sched_scan_plan_interval) ||
  2560			    nla_put_u32(msg, NL80211_ATTR_MAX_SCAN_PLAN_ITERATIONS,
  2561					rdev->wiphy.max_sched_scan_plan_iterations))
  2562				goto nla_put_failure;
  2563	
  2564			if (rdev->wiphy.extended_capabilities &&
  2565			    (nla_put(msg, NL80211_ATTR_EXT_CAPA,
  2566				     rdev->wiphy.extended_capabilities_len,
  2567				     rdev->wiphy.extended_capabilities) ||
  2568			     nla_put(msg, NL80211_ATTR_EXT_CAPA_MASK,
  2569				     rdev->wiphy.extended_capabilities_len,
  2570				     rdev->wiphy.extended_capabilities_mask)))
  2571				goto nla_put_failure;
  2572	
  2573			if (rdev->wiphy.vht_capa_mod_mask &&
  2574			    nla_put(msg, NL80211_ATTR_VHT_CAPABILITY_MASK,
  2575				    sizeof(*rdev->wiphy.vht_capa_mod_mask),
  2576				    rdev->wiphy.vht_capa_mod_mask))
  2577				goto nla_put_failure;
  2578	
  2579			if (nla_put(msg, NL80211_ATTR_MAC, ETH_ALEN,
  2580				    rdev->wiphy.perm_addr))
  2581				goto nla_put_failure;
  2582	
  2583			if (!is_zero_ether_addr(rdev->wiphy.addr_mask) &&
  2584			    nla_put(msg, NL80211_ATTR_MAC_MASK, ETH_ALEN,
  2585				    rdev->wiphy.addr_mask))
  2586				goto nla_put_failure;
  2587	
  2588			if (rdev->wiphy.n_addresses > 1) {
  2589				void *attr;
  2590	
  2591				attr = nla_nest_start(msg, NL80211_ATTR_MAC_ADDRS);
  2592				if (!attr)
  2593					goto nla_put_failure;
  2594	
  2595				for (i = 0; i < rdev->wiphy.n_addresses; i++)
  2596					if (nla_put(msg, i + 1, ETH_ALEN,
  2597						    rdev->wiphy.addresses[i].addr))
  2598						goto nla_put_failure;
  2599	
  2600				nla_nest_end(msg, attr);
  2601			}
  2602	
  2603			state->split_start++;
  2604			break;
  2605		case 10:
  2606			if (nl80211_send_coalesce(msg, rdev))
  2607				goto nla_put_failure;
  2608	
  2609			if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_5_10_MHZ) &&
  2610			    (nla_put_flag(msg, NL80211_ATTR_SUPPORT_5_MHZ) ||
  2611			     nla_put_flag(msg, NL80211_ATTR_SUPPORT_10_MHZ)))
  2612				goto nla_put_failure;
  2613	
  2614			if (rdev->wiphy.max_ap_assoc_sta &&
  2615			    nla_put_u32(msg, NL80211_ATTR_MAX_AP_ASSOC_STA,
  2616					rdev->wiphy.max_ap_assoc_sta))
  2617				goto nla_put_failure;
  2618	
  2619			state->split_start++;
  2620			break;
  2621		case 11:
  2622			if (rdev->wiphy.n_vendor_commands) {
  2623				const struct nl80211_vendor_cmd_info *info;
  2624				struct nlattr *nested;
  2625	
  2626				nested = nla_nest_start_noflag(msg,
  2627							       NL80211_ATTR_VENDOR_DATA);
  2628				if (!nested)
  2629					goto nla_put_failure;
  2630	
  2631				for (i = 0; i < rdev->wiphy.n_vendor_commands; i++) {
  2632					info = &rdev->wiphy.vendor_commands[i].info;
  2633					if (nla_put(msg, i + 1, sizeof(*info), info))
  2634						goto nla_put_failure;
  2635				}
  2636				nla_nest_end(msg, nested);
  2637			}
  2638	
  2639			if (rdev->wiphy.n_vendor_events) {
  2640				const struct nl80211_vendor_cmd_info *info;
  2641				struct nlattr *nested;
  2642	
  2643				nested = nla_nest_start_noflag(msg,
  2644							       NL80211_ATTR_VENDOR_EVENTS);
  2645				if (!nested)
  2646					goto nla_put_failure;
  2647	
  2648				for (i = 0; i < rdev->wiphy.n_vendor_events; i++) {
  2649					info = &rdev->wiphy.vendor_events[i];
  2650					if (nla_put(msg, i + 1, sizeof(*info), info))
  2651						goto nla_put_failure;
  2652				}
  2653				nla_nest_end(msg, nested);
  2654			}
  2655			state->split_start++;
  2656			break;
  2657		case 12:
  2658			if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH &&
  2659			    nla_put_u8(msg, NL80211_ATTR_MAX_CSA_COUNTERS,
  2660				       rdev->wiphy.max_num_csa_counters))
  2661				goto nla_put_failure;
  2662	
  2663			if (rdev->wiphy.regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED &&
  2664			    nla_put_flag(msg, NL80211_ATTR_WIPHY_SELF_MANAGED_REG))
  2665				goto nla_put_failure;
  2666	
  2667			if (rdev->wiphy.max_sched_scan_reqs &&
  2668			    nla_put_u32(msg, NL80211_ATTR_SCHED_SCAN_MAX_REQS,
  2669					rdev->wiphy.max_sched_scan_reqs))
  2670				goto nla_put_failure;
  2671	
  2672			if (nla_put(msg, NL80211_ATTR_EXT_FEATURES,
  2673				    sizeof(rdev->wiphy.ext_features),
  2674				    rdev->wiphy.ext_features))
  2675				goto nla_put_failure;
  2676	
  2677			if (rdev->wiphy.bss_select_support) {
  2678				struct nlattr *nested;
  2679				u32 bss_select_support = rdev->wiphy.bss_select_support;
  2680	
  2681				nested = nla_nest_start_noflag(msg,
  2682							       NL80211_ATTR_BSS_SELECT);
  2683				if (!nested)
  2684					goto nla_put_failure;
  2685	
  2686				i = 0;
  2687				while (bss_select_support) {
  2688					if ((bss_select_support & 1) &&
  2689					    nla_put_flag(msg, i))
  2690						goto nla_put_failure;
  2691					i++;
  2692					bss_select_support >>= 1;
  2693				}
  2694				nla_nest_end(msg, nested);
  2695			}
  2696	
  2697			state->split_start++;
  2698			break;
  2699		case 13:
  2700			if (rdev->wiphy.num_iftype_ext_capab &&
  2701			    rdev->wiphy.iftype_ext_capab) {
  2702				struct nlattr *nested_ext_capab, *nested;
  2703	
  2704				nested = nla_nest_start_noflag(msg,
  2705							       NL80211_ATTR_IFTYPE_EXT_CAPA);
  2706				if (!nested)
  2707					goto nla_put_failure;
  2708	
  2709				for (i = state->capa_start;
  2710				     i < rdev->wiphy.num_iftype_ext_capab; i++) {
  2711					const struct wiphy_iftype_ext_capab *capab;
  2712	
  2713					capab = &rdev->wiphy.iftype_ext_capab[i];
  2714	
  2715					nested_ext_capab = nla_nest_start_noflag(msg,
  2716										 i);
  2717					if (!nested_ext_capab ||
  2718					    nla_put_u32(msg, NL80211_ATTR_IFTYPE,
  2719							capab->iftype) ||
  2720					    nla_put(msg, NL80211_ATTR_EXT_CAPA,
  2721						    capab->extended_capabilities_len,
  2722						    capab->extended_capabilities) ||
  2723					    nla_put(msg, NL80211_ATTR_EXT_CAPA_MASK,
  2724						    capab->extended_capabilities_len,
  2725						    capab->extended_capabilities_mask))
  2726						goto nla_put_failure;
  2727	
  2728					nla_nest_end(msg, nested_ext_capab);
  2729					if (state->split)
  2730						break;
  2731				}
  2732				nla_nest_end(msg, nested);
  2733				if (i < rdev->wiphy.num_iftype_ext_capab) {
  2734					state->capa_start = i + 1;
  2735					break;
  2736				}
  2737			}
  2738	
  2739			if (nla_put_u32(msg, NL80211_ATTR_BANDS,
  2740					rdev->wiphy.nan_supported_bands))
  2741				goto nla_put_failure;
  2742	
  2743			if (wiphy_ext_feature_isset(&rdev->wiphy,
  2744						    NL80211_EXT_FEATURE_TXQS)) {
  2745				struct cfg80211_txq_stats txqstats = {};
  2746				int res;
  2747	
  2748				res = rdev_get_txq_stats(rdev, NULL, &txqstats);
  2749				if (!res &&
  2750				    !nl80211_put_txq_stats(msg, &txqstats,
  2751							   NL80211_ATTR_TXQ_STATS))
  2752					goto nla_put_failure;
  2753	
  2754				if (nla_put_u32(msg, NL80211_ATTR_TXQ_LIMIT,
  2755						rdev->wiphy.txq_limit))
  2756					goto nla_put_failure;
  2757				if (nla_put_u32(msg, NL80211_ATTR_TXQ_MEMORY_LIMIT,
  2758						rdev->wiphy.txq_memory_limit))
  2759					goto nla_put_failure;
  2760				if (nla_put_u32(msg, NL80211_ATTR_TXQ_QUANTUM,
  2761						rdev->wiphy.txq_quantum))
  2762					goto nla_put_failure;
  2763			}
  2764	
  2765			state->split_start++;
  2766			break;
  2767		case 14:
  2768			if (nl80211_send_pmsr_capa(rdev, msg))
  2769				goto nla_put_failure;
  2770	
  2771			state->split_start++;
  2772			break;
  2773		case 15:
  2774			if (rdev->wiphy.akm_suites &&
  2775			    nla_put(msg, NL80211_ATTR_AKM_SUITES,
  2776				    sizeof(u32) * rdev->wiphy.n_akm_suites,
  2777				    rdev->wiphy.akm_suites))
  2778				goto nla_put_failure;
  2779	
  2780			if (nl80211_put_iftype_akm_suites(rdev, msg))
  2781				goto nla_put_failure;
  2782	
  2783			if (nl80211_put_tid_config_support(rdev, msg))
  2784				goto nla_put_failure;
  2785			state->split_start++;
  2786			break;
  2787		case 16:
  2788			if (nl80211_put_sar_specs(rdev, msg))
  2789				goto nla_put_failure;
  2790	
  2791			/* done */
  2792			state->split_start = 0;
  2793			break;
  2794		}
  2795	 finish:
  2796		genlmsg_end(msg, hdr);
  2797		return 0;
  2798	
  2799	 nla_put_failure:
  2800		genlmsg_cancel(msg, hdr);
  2801		return -EMSGSIZE;
  2802	}
  2803	

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

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

  reply	other threads:[~2021-07-12 22:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-12 19:53 [PATCH] nl80211: limit band information in non-split data Johannes Berg
2021-07-12 22:55 ` kernel test robot [this message]
2021-07-12 22:55   ` 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=202107130652.sEwRPIkh-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-wireless@vger.kernel.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.