All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: oe-kbuild-all@lists.linux.dev
Subject: Re: [RFC PATCH] wifi: cfg80211: fix CQM for non-range use
Date: Thu, 9 Nov 2023 08:02:51 +0800	[thread overview]
Message-ID: <202311090752.hWcJWAHL-lkp@intel.com> (raw)
In-Reply-To: <20231106231715.3a506ac2dadb.Ie774b85b9d4ff934a1236e77096cb9c6c9fe6561@changeid>

Hi Johannes,

[This is a private test report for your RFC patch.]
kernel test robot noticed the following build warnings:

[auto build test WARNING on wireless-next/main]
[also build test WARNING on wireless/main linus/master next-20231108]
[cannot apply to v6.6]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Johannes-Berg/wifi-cfg80211-fix-CQM-for-non-range-use/20231107-071337
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git main
patch link:    https://lore.kernel.org/r/20231106231715.3a506ac2dadb.Ie774b85b9d4ff934a1236e77096cb9c6c9fe6561%40changeid
patch subject: [RFC PATCH] wifi: cfg80211: fix CQM for non-range use
config: x86_64-buildonly-randconfig-006-20231108 (https://download.01.org/0day-ci/archive/20231109/202311090752.hWcJWAHL-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/20231109/202311090752.hWcJWAHL-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/202311090752.hWcJWAHL-lkp@intel.com/

All warnings (new ones prefixed by >>):

   net/wireless/nl80211.c: In function 'nl80211_set_cqm_rssi.isra':
>> net/wireless/nl80211.c:12892:17: warning: 'memcpy' specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
   12892 |                 memcpy(cqm_config->rssi_thresholds, thresholds,
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   12893 |                        flex_array_size(cqm_config, rssi_thresholds,
         |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   12894 |                                        n_thresholds));
         |                                        ~~~~~~~~~~~~~~


vim +/memcpy +12892 net/wireless/nl80211.c

4a4b8169501b18 Andrew Zaborowski 2017-02-10  12840  
d6dc1a38635897 Juuso Oikarinen   2010-03-23  12841  static int nl80211_set_cqm_rssi(struct genl_info *info,
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12842  				const s32 *thresholds, int n_thresholds,
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12843  				u32 hysteresis)
d6dc1a38635897 Juuso Oikarinen   2010-03-23  12844  {
4c476991062a0a Johannes Berg     2010-10-04  12845  	struct cfg80211_registered_device *rdev = info->user_ptr[0];
37c20b2effe987 Johannes Berg     2023-08-16  12846  	struct cfg80211_cqm_config *cqm_config = NULL, *old;
4c476991062a0a Johannes Berg     2010-10-04  12847  	struct net_device *dev = info->user_ptr[1];
1da5fcc86d7104 Johannes Berg     2013-08-06  12848  	struct wireless_dev *wdev = dev->ieee80211_ptr;
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12849  	s32 prev = S32_MIN;
7d6904bf26b96e Johannes Berg     2023-10-05  12850  	int i, err;
d6dc1a38635897 Juuso Oikarinen   2010-03-23  12851  
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12852  	/* Check all values negative and sorted */
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12853  	for (i = 0; i < n_thresholds; i++) {
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12854  		if (thresholds[i] > 0 || thresholds[i] <= prev)
d6dc1a38635897 Juuso Oikarinen   2010-03-23  12855  			return -EINVAL;
d6dc1a38635897 Juuso Oikarinen   2010-03-23  12856  
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12857  		prev = thresholds[i];
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12858  	}
d6dc1a38635897 Juuso Oikarinen   2010-03-23  12859  
074ac8df9f93f2 Johannes Berg     2010-09-16  12860  	if (wdev->iftype != NL80211_IFTYPE_STATION &&
4c476991062a0a Johannes Berg     2010-10-04  12861  	    wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
4c476991062a0a Johannes Berg     2010-10-04  12862  		return -EOPNOTSUPP;
d6dc1a38635897 Juuso Oikarinen   2010-03-23  12863  
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12864  	if (n_thresholds == 1 && thresholds[0] == 0) /* Disabling */
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12865  		n_thresholds = 0;
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12866  
7d6904bf26b96e Johannes Berg     2023-10-05  12867  	old = wiphy_dereference(wdev->wiphy, wdev->cqm_config);
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12868  
54e1e1c490f4db Johannes Berg     2023-11-06  12869  	/* if already disabled just succeed */
54e1e1c490f4db Johannes Berg     2023-11-06  12870  	if (!n_thresholds && !old)
54e1e1c490f4db Johannes Berg     2023-11-06  12871  		return 0;
54e1e1c490f4db Johannes Berg     2023-11-06  12872  
54e1e1c490f4db Johannes Berg     2023-11-06  12873  	if (n_thresholds > 1) {
54e1e1c490f4db Johannes Berg     2023-11-06  12874  		if (!wiphy_ext_feature_isset(&rdev->wiphy,
54e1e1c490f4db Johannes Berg     2023-11-06  12875  					     NL80211_EXT_FEATURE_CQM_RSSI_LIST) ||
54e1e1c490f4db Johannes Berg     2023-11-06  12876  		    !rdev->ops->set_cqm_rssi_range_config)
54e1e1c490f4db Johannes Berg     2023-11-06  12877  			return -EOPNOTSUPP;
54e1e1c490f4db Johannes Berg     2023-11-06  12878  	} else {
54e1e1c490f4db Johannes Berg     2023-11-06  12879  		if (!rdev->ops->set_cqm_rssi_config)
54e1e1c490f4db Johannes Berg     2023-11-06  12880  			return -EOPNOTSUPP;
54e1e1c490f4db Johannes Berg     2023-11-06  12881  	}
54e1e1c490f4db Johannes Berg     2023-11-06  12882  
37c20b2effe987 Johannes Berg     2023-08-16  12883  	if (n_thresholds) {
40f231e75a1d98 Len Baker         2021-09-19  12884  		cqm_config = kzalloc(struct_size(cqm_config, rssi_thresholds,
40f231e75a1d98 Len Baker         2021-09-19  12885  						 n_thresholds),
40f231e75a1d98 Len Baker         2021-09-19  12886  				     GFP_KERNEL);
076fc8775dafe9 Johannes Berg     2023-08-29  12887  		if (!cqm_config)
076fc8775dafe9 Johannes Berg     2023-08-29  12888  			return -ENOMEM;
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12889  
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12890  		cqm_config->rssi_hyst = hysteresis;
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12891  		cqm_config->n_rssi_thresholds = n_thresholds;
4a4b8169501b18 Andrew Zaborowski 2017-02-10 @12892  		memcpy(cqm_config->rssi_thresholds, thresholds,
40f231e75a1d98 Len Baker         2021-09-19  12893  		       flex_array_size(cqm_config, rssi_thresholds,
40f231e75a1d98 Len Baker         2021-09-19  12894  				       n_thresholds));
54e1e1c490f4db Johannes Berg     2023-11-06  12895  		cqm_config->use_range_api = n_thresholds > 1 ||
54e1e1c490f4db Johannes Berg     2023-11-06  12896  					    !rdev->ops->set_cqm_rssi_config;
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12897  
37c20b2effe987 Johannes Berg     2023-08-16  12898  		rcu_assign_pointer(wdev->cqm_config, cqm_config);
54e1e1c490f4db Johannes Berg     2023-11-06  12899  
54e1e1c490f4db Johannes Berg     2023-11-06  12900  		if (cqm_config->use_range_api)
54e1e1c490f4db Johannes Berg     2023-11-06  12901  			err = cfg80211_cqm_rssi_update(rdev, dev, cqm_config);
54e1e1c490f4db Johannes Berg     2023-11-06  12902  		else
54e1e1c490f4db Johannes Berg     2023-11-06  12903  			err = rdev_set_cqm_rssi_config(rdev, dev,
54e1e1c490f4db Johannes Berg     2023-11-06  12904  						       thresholds[0],
54e1e1c490f4db Johannes Berg     2023-11-06  12905  						       hysteresis);
37c20b2effe987 Johannes Berg     2023-08-16  12906  	} else {
37c20b2effe987 Johannes Berg     2023-08-16  12907  		RCU_INIT_POINTER(wdev->cqm_config, NULL);
54e1e1c490f4db Johannes Berg     2023-11-06  12908  		/* if enabled as range also disable via range */
54e1e1c490f4db Johannes Berg     2023-11-06  12909  		if (old->use_range_api)
54e1e1c490f4db Johannes Berg     2023-11-06  12910  			err = rdev_set_cqm_rssi_range_config(rdev, dev, 0, 0);
54e1e1c490f4db Johannes Berg     2023-11-06  12911  		else
54e1e1c490f4db Johannes Berg     2023-11-06  12912  			err = rdev_set_cqm_rssi_config(rdev, dev, 0, 0);
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12913  	}
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12914  
37c20b2effe987 Johannes Berg     2023-08-16  12915  	if (err) {
37c20b2effe987 Johannes Berg     2023-08-16  12916  		rcu_assign_pointer(wdev->cqm_config, old);
37c20b2effe987 Johannes Berg     2023-08-16  12917  		kfree_rcu(cqm_config, rcu_head);
37c20b2effe987 Johannes Berg     2023-08-16  12918  	} else {
37c20b2effe987 Johannes Berg     2023-08-16  12919  		kfree_rcu(old, rcu_head);
37c20b2effe987 Johannes Berg     2023-08-16  12920  	}
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12921  
4a4b8169501b18 Andrew Zaborowski 2017-02-10  12922  	return err;
d6dc1a38635897 Juuso Oikarinen   2010-03-23  12923  }
d6dc1a38635897 Juuso Oikarinen   2010-03-23  12924  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

WARNING: multiple messages have this Message-ID (diff)
From: Michael Walle <mwalle@kernel.org>
To: johannes@sipsolutions.net
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	linux-wireless@vger.kernel.org,
	Max Schulze <max.schulze@online.de>,
	Michael Walle <mwalle@kernel.org>
Subject: Re: [RFC PATCH] wifi: cfg80211: fix CQM for non-range use
Date: Tue, 28 Nov 2023 15:44:48 +0100	[thread overview]
Message-ID: <202311090752.hWcJWAHL-lkp@intel.com> (raw)
Message-ID: <20231128144448.2hnvdgvp9ERif-KXwcXyOIV9Hhvpgt2XFJbSUPXXKDk@z> (raw)
In-Reply-To: <202311090752.hWcJWAHL-lkp@intel.com>

Hi,

> net/wireless/nl80211.c: In function 'nl80211_set_cqm_rssi.isra':
> net/wireless/nl80211.c:12892:17: warning: 'memcpy' specified bound
> 18446744073709551615 exceeds maximum object size 9223372036854775807
> [-Wstringop-overflow=]

FWIW, I'm getting the same error with the current next (next-20231128).

-michael

  reply	other threads:[~2023-11-09  0:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-06 22:17 [RFC PATCH] wifi: cfg80211: fix CQM for non-range use Johannes Berg
2023-11-09  0:02 ` kernel test robot [this message]
2023-11-28 14:44   ` Michael Walle
2023-11-28 18:23   ` Johannes Berg
2023-11-28 21:01     ` Jeff Johnson
2023-11-30 18:32       ` Kees Cook
2023-11-30 18:40         ` Johannes Berg
2023-11-30 18:46           ` Kees Cook
2023-11-30 18:52             ` Johannes Berg
2023-11-30 18:52           ` Kees Cook
2023-11-30 18:54             ` Johannes Berg
2023-11-30 18:55           ` Kees Cook
2023-11-30 19:00             ` Johannes Berg
2023-11-28 17:47 ` Michael Krause

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=202311090752.hWcJWAHL-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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.