Search Linux Wireless

[mac80211-next:master 3/5] net//wireless/wext-compat.c:1351:9: warning: function returns address of local variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
head:   076dc671ee9fa374e77c3d05925dafb75b23a74c
commit: c179e91512cab01e83be35a60eaeda0f170a9101 [3/5] cfg80211: wext: don't use static struct
config: x86_64-randconfig-x016-01221834 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
        git checkout c179e91512cab01e83be35a60eaeda0f170a9101
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   net//wireless/wext-compat.c: In function 'cfg80211_wireless_stats':
>> net//wireless/wext-compat.c:1351:9: warning: function returns address of local variable [-Wreturn-local-addr]
     return &wstats;
            ^~~~~~~

vim +1351 net//wireless/wext-compat.c

8990646d2 Johannes Berg 2009-07-01  1289  
8990646d2 Johannes Berg 2009-07-01  1290  /* Get wireless statistics.  Called by /proc/net/wireless and by SIOCGIWSTATS */
04b0c5c69 Johannes Berg 2011-07-15  1291  static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
8990646d2 Johannes Berg 2009-07-01  1292  {
8990646d2 Johannes Berg 2009-07-01  1293  	struct wireless_dev *wdev = dev->ieee80211_ptr;
f26cbf401 Zhao, Gang    2014-04-21  1294  	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);
c179e9151 Johannes Berg 2018-01-16  1295  	struct iw_statistics wstats = {};
c179e9151 Johannes Berg 2018-01-16  1296  	struct station_info sinfo = {};
c56c5714f Johannes Berg 2009-07-10  1297  	u8 bssid[ETH_ALEN];
8990646d2 Johannes Berg 2009-07-01  1298  
8990646d2 Johannes Berg 2009-07-01  1299  	if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION)
8990646d2 Johannes Berg 2009-07-01  1300  		return NULL;
8990646d2 Johannes Berg 2009-07-01  1301  
8990646d2 Johannes Berg 2009-07-01  1302  	if (!rdev->ops->get_station)
8990646d2 Johannes Berg 2009-07-01  1303  		return NULL;
8990646d2 Johannes Berg 2009-07-01  1304  
c56c5714f Johannes Berg 2009-07-10  1305  	/* Grab BSSID of current BSS, if any */
c56c5714f Johannes Berg 2009-07-10  1306  	wdev_lock(wdev);
c56c5714f Johannes Berg 2009-07-10  1307  	if (!wdev->current_bss) {
c56c5714f Johannes Berg 2009-07-10  1308  		wdev_unlock(wdev);
8990646d2 Johannes Berg 2009-07-01  1309  		return NULL;
c56c5714f Johannes Berg 2009-07-10  1310  	}
c56c5714f Johannes Berg 2009-07-10  1311  	memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN);
c56c5714f Johannes Berg 2009-07-10  1312  	wdev_unlock(wdev);
8990646d2 Johannes Berg 2009-07-01  1313  
e35e4d28b Hila Gonen    2012-06-27  1314  	if (rdev_get_station(rdev, dev, bssid, &sinfo))
8990646d2 Johannes Berg 2009-07-01  1315  		return NULL;
8990646d2 Johannes Berg 2009-07-01  1316  
8990646d2 Johannes Berg 2009-07-01  1317  	switch (rdev->wiphy.signal_type) {
8990646d2 Johannes Berg 2009-07-01  1318  	case CFG80211_SIGNAL_TYPE_MBM:
319090bf6 Johannes Berg 2014-11-17  1319  		if (sinfo.filled & BIT(NL80211_STA_INFO_SIGNAL)) {
8990646d2 Johannes Berg 2009-07-01  1320  			int sig = sinfo.signal;
8990646d2 Johannes Berg 2009-07-01  1321  			wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED;
8990646d2 Johannes Berg 2009-07-01  1322  			wstats.qual.updated |= IW_QUAL_QUAL_UPDATED;
8990646d2 Johannes Berg 2009-07-01  1323  			wstats.qual.updated |= IW_QUAL_DBM;
8990646d2 Johannes Berg 2009-07-01  1324  			wstats.qual.level = sig;
8990646d2 Johannes Berg 2009-07-01  1325  			if (sig < -110)
8990646d2 Johannes Berg 2009-07-01  1326  				sig = -110;
8990646d2 Johannes Berg 2009-07-01  1327  			else if (sig > -40)
8990646d2 Johannes Berg 2009-07-01  1328  				sig = -40;
8990646d2 Johannes Berg 2009-07-01  1329  			wstats.qual.qual = sig + 110;
8990646d2 Johannes Berg 2009-07-01  1330  			break;
8990646d2 Johannes Berg 2009-07-01  1331  		}
8990646d2 Johannes Berg 2009-07-01  1332  	case CFG80211_SIGNAL_TYPE_UNSPEC:
319090bf6 Johannes Berg 2014-11-17  1333  		if (sinfo.filled & BIT(NL80211_STA_INFO_SIGNAL)) {
8990646d2 Johannes Berg 2009-07-01  1334  			wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED;
8990646d2 Johannes Berg 2009-07-01  1335  			wstats.qual.updated |= IW_QUAL_QUAL_UPDATED;
8990646d2 Johannes Berg 2009-07-01  1336  			wstats.qual.level = sinfo.signal;
8990646d2 Johannes Berg 2009-07-01  1337  			wstats.qual.qual = sinfo.signal;
8990646d2 Johannes Berg 2009-07-01  1338  			break;
8990646d2 Johannes Berg 2009-07-01  1339  		}
8990646d2 Johannes Berg 2009-07-01  1340  	default:
8990646d2 Johannes Berg 2009-07-01  1341  		wstats.qual.updated |= IW_QUAL_LEVEL_INVALID;
8990646d2 Johannes Berg 2009-07-01  1342  		wstats.qual.updated |= IW_QUAL_QUAL_INVALID;
8990646d2 Johannes Berg 2009-07-01  1343  	}
8990646d2 Johannes Berg 2009-07-01  1344  
8990646d2 Johannes Berg 2009-07-01  1345  	wstats.qual.updated |= IW_QUAL_NOISE_INVALID;
319090bf6 Johannes Berg 2014-11-17  1346  	if (sinfo.filled & BIT(NL80211_STA_INFO_RX_DROP_MISC))
5a5c731aa Ben Greear    2010-10-07  1347  		wstats.discard.misc = sinfo.rx_dropped_misc;
319090bf6 Johannes Berg 2014-11-17  1348  	if (sinfo.filled & BIT(NL80211_STA_INFO_TX_FAILED))
5a5c731aa Ben Greear    2010-10-07  1349  		wstats.discard.retries = sinfo.tx_failed;
8990646d2 Johannes Berg 2009-07-01  1350  
8990646d2 Johannes Berg 2009-07-01 @1351  	return &wstats;
8990646d2 Johannes Berg 2009-07-01  1352  }
562e48226 Johannes Berg 2009-07-27  1353  

:::::: The code at line 1351 was first introduced by commit
:::::: 8990646d2fafeacfacba4a4b1073a4216662089a cfg80211: implement get_wireless_stats

:::::: TO: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
:::::: CC: John W. Linville <linville@xxxxxxxxxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux