wlan: Rectify the correct size while putting wifi stats
Presently there is an error in the calculation of the size.
The member tSirWifiRateStat is an static array of size 1 and not a
pointer. Thus while incrementing the size for the next instance, a page
fault occurs.
Instead of using numRates, use numRates-1 as the structure already
accounts for the first size.
Change-Id: Ic92179d1eb324f2092887a487f4a32598298a1b3
CRs-Fixed: 2357163
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 046f8b9..f327993 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -1917,6 +1917,7 @@
stats->rateStats +
(i * sizeof(tSirWifiRateStat)));
rates = nla_nest_start(vendor_event, i);
+
if(!rates)
return FALSE;
@@ -2402,10 +2403,10 @@
return;
}
- pWifiPeerInfo = (tpSirWifiPeerInfo) ((uint8 *)
- pWifiPeerStat->peerInfo +
- (i * sizeof(tSirWifiPeerInfo)) +
- (numRate * sizeof (tSirWifiRateStat)));
+ pWifiPeerInfo = (tpSirWifiPeerInfo)((uint8 *)pWifiPeerInfo +
+ (sizeof(tSirWifiPeerInfo) - sizeof(tSirWifiRateStat)) +
+ (numRate * sizeof(tSirWifiRateStat)));
+
nla_nest_end(vendor_event, peers);
}
nla_nest_end(vendor_event, peerInfo);