Explorar o código

qcacld-3.0: Fix defects detected by Static code analyser

qcacld-2.0 to qcacld-3.0 propagation

Static code analyser detects uninitialized pointer/structure
access and dereferencing a pointer without null check.
As part of this fix host will initialize pointer/structure before
accessing it and put a null check for pointer access.

Change-Id: I5647b36a6ba0e84354d39799bf68a28df633cf20
CRs-Fixed: 836071
Mukul Sharma %!s(int64=9) %!d(string=hai) anos
pai
achega
9f4dcdc973
Modificáronse 2 ficheiros con 3 adicións e 4 borrados
  1. 1 1
      core/hdd/src/wlan_hdd_ipa.c
  2. 2 3
      core/hdd/src/wlan_hdd_wext.c

+ 1 - 1
core/hdd/src/wlan_hdd_ipa.c

@@ -2596,6 +2596,7 @@ static void hdd_ipa_i2w_cb(void *priv, enum ipa_dp_evt_type evt,
 	struct hdd_ipa_pm_tx_cb *pm_tx_cb = NULL;
 	CDF_STATUS status = CDF_STATUS_SUCCESS;
 
+	iface_context = (struct hdd_ipa_iface_context *)priv;
 	if (evt != IPA_RECEIVE) {
 		skb = (cdf_nbuf_t) data;
 		dev_kfree_skb_any(skb);
@@ -2603,7 +2604,6 @@ static void hdd_ipa_i2w_cb(void *priv, enum ipa_dp_evt_type evt,
 		return;
 	}
 
-	iface_context = (struct hdd_ipa_iface_context *)priv;
 	ipa_tx_desc = (struct ipa_rx_data *)data;
 
 	hdd_ipa = iface_context->hdd_ipa;

+ 2 - 3
core/hdd/src/wlan_hdd_wext.c

@@ -4898,6 +4898,7 @@ static int __iw_setint_getnone(struct net_device *dev,
 	int enable_pbm, enable_mp;
 
 	INIT_COMPLETION(pWextState->completion_var);
+	memset(&smeConfig, 0x00, sizeof(smeConfig));
 
 	hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
 	ret = wlan_hdd_validate_context(hdd_ctx);
@@ -4910,7 +4911,6 @@ static int __iw_setint_getnone(struct net_device *dev,
 		if ((ENABLE_11D == set_value)
 		    || (DISABLE_11D == set_value)) {
 
-			memset(&smeConfig, 0x00, sizeof(smeConfig));
 			sme_get_config_param(hHal, &smeConfig);
 			smeConfig.csrConfig.Is11dSupportEnabled =
 				(bool) set_value;
@@ -5401,7 +5401,6 @@ static int __iw_setint_getnone(struct net_device *dev,
 							      nChannelBondingMode5GHz)))
 			chwidth = true;
 
-		memset(&smeConfig, 0x00, sizeof(smeConfig));
 		sme_get_config_param(hHal, &smeConfig);
 		switch (set_value) {
 		case eHT_CHANNEL_WIDTH_20MHZ:
@@ -7000,7 +6999,7 @@ static int __iw_get_char_setnone(struct net_device *dev,
 			adapter_num++;
 		}
 
-		if (pMac) {
+		if (hHal) {
 			/* Printing Lim State starting with global lim states */
 			buf =
 				scnprintf(extra + len, WE_MAX_STR_LEN - len,