qcacmn: Resolve static analysis issue

check null pointer for soc return val and
check array index input for out of bound access.

Change-Id: Ib1d52f70128eaf9ba24e9024440490e470fec3d4
CRs-Fixed: 3127451
This commit is contained in:
sandhu
2022-02-10 10:57:09 -08:00
committed by Madan Koyyalamudi
parent cf11e93c66
commit 9598f6b6c4
2 changed files with 13 additions and 0 deletions

View File

@@ -10835,6 +10835,7 @@ QDF_STATUS dp_sysfs_fill_stats(ol_txrx_soc_handle soc_hdl,
uint32_t host_stats = 0;
enum cdp_stats stats;
struct cdp_txrx_stats_req req;
uint32_t num_stats;
struct dp_soc *soc = NULL;
if (!soc_hdl) {
@@ -10863,6 +10864,14 @@ QDF_STATUS dp_sysfs_fill_stats(ol_txrx_soc_handle soc_hdl,
if (stats > CDP_TXRX_MAX_STATS)
stats = stats + DP_CURR_FW_STATS_AVAIL - DP_HTT_DBG_EXT_STATS_MAX;
num_stats = QDF_ARRAY_SIZE(dp_stats_mapping_table);
if (stats >= num_stats) {
dp_cdp_err("%pK : Invalid stats option: %d, max num stats: %d",
soc, stats, num_stats);
return QDF_STATUS_E_INVAL;
}
/* build request */
fw_stats = dp_stats_mapping_table[stats][STATS_FW];
host_stats = dp_stats_mapping_table[stats][STATS_HOST];