* [mac80211-next:master 3/5] net//wireless/wext-compat.c:1351:9: warning: function returns address of local variable
@ 2018-01-22 13:00 kbuild test robot
2018-01-25 3:41 ` Pkshih
0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2018-01-22 13:00 UTC (permalink / raw)
To: Johannes Berg; +Cc: kbuild-all, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 5790 bytes --]
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@sipsolutions.net>
:::::: CC: John W. Linville <linville@tuxdriver.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34647 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [mac80211-next:master 3/5] net//wireless/wext-compat.c:1351:9: warning: function returns address of local variable
2018-01-22 13:00 [mac80211-next:master 3/5] net//wireless/wext-compat.c:1351:9: warning: function returns address of local variable kbuild test robot
@ 2018-01-25 3:41 ` Pkshih
2018-01-25 9:22 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Pkshih @ 2018-01-25 3:41 UTC (permalink / raw)
To: johannes.berg; +Cc: kbuild-all, linux-wireless, fengguang.wu
T24gTW9uLCAyMDE4LTAxLTIyIGF0IDEzOjAwICswMDAwLCBrYnVpbGQgdGVzdCByb2JvdCB3cm90
ZToNCj4gdHJlZTrCoMKgwqBodHRwczovL2dpdC5rZXJuZWwub3JnL3B1Yi9zY20vbGludXgva2Vy
bmVsL2dpdC9qYmVyZy9tYWM4MDIxMS1uZXh0LmdpDQo+IHQgbWFzdGVyDQo+IGhlYWQ6wqDCoMKg
MDc2ZGM2NzFlZTlmYTM3NGU3N2MzZDA1OTI1ZGFmYjc1YjIzYTc0Yw0KPiBjb21taXQ6IGMxNzll
OTE1MTJjYWIwMWU4M2JlMzVhNjBlYWVkYTBmMTcwYTkxMDEgWzMvNV0gY2ZnODAyMTE6IHdleHQ6
IGRvbid0DQo+IHVzZSBzdGF0aWMgc3RydWN0DQo+IGNvbmZpZzogeDg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HByb2JsZW0sIGJ1dA0KbXkgcHJpb3IgZXhwZXJpbWVudCBs
b29rcyBmaW5lLiBIZW5jZSwgSSBjaGVjayB0aGUgY2FsbGVycyBvZiBnZXRfd2lyZWxlc3Nfc3Rh
dHMoKSwNCmFuZCBmb3VuZCB0aGV5IHVzZSB0aGUgYWRkcmVzcyB0aGF0IHBvaW50cyB0byBzdGFj
ayBpbW1lZGlhdGVseSwgc28gY29udGVudCBvZg0Kc3RhY2sgd2Fzbid0IGJyb2tlbiBsdWNraWx5
Lg0KDQpTbywgcGxlYXNlIHJlY2FsbCB0aGUgJ3N0YXRpYycgb2YgJ3N0cnVjdCBpd19zdGF0aXN0
aWNzIHdzdGF0cycuDQpUaGFua3MNClBLDQoNCg==
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [mac80211-next:master 3/5] net//wireless/wext-compat.c:1351:9: warning: function returns address of local variable
2018-01-25 3:41 ` Pkshih
@ 2018-01-25 9:22 ` Johannes Berg
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2018-01-25 9:22 UTC (permalink / raw)
To: Pkshih; +Cc: kbuild-all, linux-wireless, fengguang.wu
On Thu, 2018-01-25 at 03:41 +0000, Pkshih wrote:
>
> In commit c179e9151, you remove 'static' from struct, but function return the
> address of local variable as kbuild robot mentioned. It is a problem, but
> my prior experiment looks fine. Hence, I check the callers of get_wireless_stats(),
> and found they use the address that points to stack immediately, so content of
> stack wasn't broken luckily.
>
> So, please recall the 'static' of 'struct iw_statistics wstats'.
Yeah, that was garbage. I dropped the patch already.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-25 9:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-22 13:00 [mac80211-next:master 3/5] net//wireless/wext-compat.c:1351:9: warning: function returns address of local variable kbuild test robot
2018-01-25 3:41 ` Pkshih
2018-01-25 9:22 ` Johannes Berg
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.