浏览代码

qcacld-3.0: Fix uninitialized scalar variable

Issue1:wlan_hdd_set_mlo_ps function returns uninitialized
status on condition of being all link_adapters as
NULL from mlo_adapter_info.
Fix:initialize status varible with -EINVAL.

Issue2:hdd_regulatory_init API updates regulatory alpha2
from uninitialized alpha2 array.
Fix:initialize alpha2 array with 0.

Change-Id: I7e279899a8465a9b457fbe06ff81c57364be2843
CRs-Fixed: 3307965
Divyajyothi Goparaju 2 年之前
父节点
当前提交
420534c839
共有 2 个文件被更改,包括 2 次插入3 次删除
  1. 1 1
      core/hdd/src/wlan_hdd_power.c
  2. 1 2
      core/hdd/src/wlan_hdd_regulatory.c

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

@@ -2873,7 +2873,7 @@ static int wlan_hdd_set_mlo_ps(struct wlan_objmgr_psoc *psoc,
 {
 	struct hdd_adapter *link_adapter;
 	struct hdd_mlo_adapter_info *mlo_adapter_info;
-	int i, status;
+	int i, status = -EINVAL;
 
 	mlo_adapter_info = &adapter->mlo_adapter_info;
 	for (i = 0; i < WLAN_MAX_MLD; i++) {

+ 1 - 2
core/hdd/src/wlan_hdd_regulatory.c

@@ -1925,7 +1925,6 @@ int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy)
 {
 	bool offload_enabled;
 	struct regulatory_channel *cur_chan_list;
-	uint8_t alpha2[REG_ALPHA2_LEN + 1];
 	int ret;
 
 	cur_chan_list = qdf_mem_malloc(sizeof(*cur_chan_list) * NUM_CHANNELS);
@@ -1967,7 +1966,7 @@ int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy)
 	fill_wiphy_band_channels(wiphy, cur_chan_list, NL80211_BAND_2GHZ);
 	fill_wiphy_band_channels(wiphy, cur_chan_list, NL80211_BAND_5GHZ);
 	fill_wiphy_6ghz_band_channels(wiphy, cur_chan_list);
-	qdf_mem_copy(hdd_ctx->reg.alpha2, alpha2, REG_ALPHA2_LEN + 1);
+	qdf_mem_zero(hdd_ctx->reg.alpha2, REG_ALPHA2_LEN + 1);
 
 	qdf_mem_free(cur_chan_list);
 	return 0;