From 2a8a64f5cf8ae50ee99e8a388421d681c562ac9f Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Sat, 28 Apr 2018 12:31:36 -0700 Subject: [PATCH] qcacld-3.0: Fix data hiding violation in __iw_get_char_setnone() Currently in __iw_get_char_setnone() while processing the WE_GET_STATES ioctl a call is made to PMAC_STRUCT() to convert a HAL handle into a tpAniSirGlobal (aka pMac). This is a data hiding violation since use of pMac should be constrained to the UMAC -- HDD should not be utilizing this data structure. And it turns out that after PMAC_STRUCT() is called the resulting pMac actually isn't used other than testing for NULL. Furthermore this is dead code since the HAL handle was already tested for NULL and hence the pMac could never be NULL at the point it is tested. So fix this data hiding violation by completely removing the code that populates and tests pMac. Change-Id: I73fc7c388f4482e5c483a4982231f934cc80ef6c CRs-Fixed: 2232897 --- core/hdd/src/wlan_hdd_wext.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index bc43a2191035..e1504aa73ced 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -6441,7 +6441,6 @@ static int __iw_get_char_setnone(struct net_device *dev, int count = 0, check = 1; tHalHandle hHal = NULL; - tpAniSirGlobal pMac = NULL; struct hdd_station_ctx *sta_ctx = NULL; struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); @@ -6495,19 +6494,9 @@ static int __iw_get_char_setnone(struct net_device *dev, hHal = WLAN_HDD_GET_HAL_CTX(useAdapter); if (!hHal) { - buf = - scnprintf(extra + len, - WE_MAX_STR_LEN - len, - "\n pMac is NULL"); - len += buf; - break; - } - pMac = PMAC_STRUCT(hHal); - if (!pMac) { - buf = - scnprintf(extra + len, - WE_MAX_STR_LEN - len, - "\n pMac is NULL"); + buf = scnprintf(extra + len, + WE_MAX_STR_LEN - len, + "\n hHal is NULL"); len += buf; break; }