Fix potential NULL pointer dereference for tme_lite_mem and tme_opt_file_mem, which are captured by static analysis tool. Change-Id: Ib2540669c55e771598dd21d8c2ae3eb297ffa67f CRs-Fixed: 3716873
@@ -5077,6 +5077,9 @@ int cnss_pci_load_tme_opt_file(struct cnss_pci_data *pci_priv,
return 0;
}
+ if (!tme_lite_mem)
+ return 0;
+
if (!tme_lite_mem->va && !tme_lite_mem->size) {
cnss_pci_add_fw_prefix_name(pci_priv, filename,
tme_opt_filename);
@@ -1023,7 +1023,8 @@ int cnss_wlfw_tme_opt_file_dnld_send_sync(struct cnss_plat_data *plat_priv,
file_name = TME_DPR_FILE_NAME;
- if (!tme_opt_file_mem->pa || !tme_opt_file_mem->size) {
+ if (!tme_opt_file_mem || !tme_opt_file_mem->pa ||
+ !tme_opt_file_mem->size) {
cnss_pr_err("Memory for TME opt file is not available\n");
ret = -ENOMEM;
goto out;