qcacld-3.0: Avoid 0 bytes mem alloc in csr_get_cfg_max_tx_power

In some cases, max_2_4_g_power.len/max_5_g_power.len value
could be 0 and driver tries to allocate 0 bytes through
qdf_mem_alloc. qdf_mem_alloc has a check for 0 size which
logs the failure and returns an error code. But this error
log could cause some delay in the roaming process
unnecessarily  as this is not an error case from roaming
perspective. It's better to avoid calling qdf_mem_alloc if
the length is 0.

Add validation for cfg_length in csr_get_cfg_max_tx_power,
if cfg_length is 0 return default maxTxPwr.

Change-Id: Ifd5d90186605e141ed2c107b4170a1d2c82bee0e
CRs-Fixed: 2768190
This commit is contained in:
Jyoti Kumari 2020-09-02 11:53:44 +05:30 committed by snandini
parent 60cef4febb
commit d9121815a2

View File

@ -13297,6 +13297,9 @@ int8_t csr_get_cfg_max_tx_power(struct mac_context *mac, uint32_t ch_freq)
return maxTxPwr;
}
if (!cfg_length)
goto error;
pCountryInfo = qdf_mem_malloc(cfg_length);
if (!pCountryInfo)
goto error;