Browse Source

qcacmn: Add sanity checks

Add sanity checks for peer and
dbr_pdev_obj->dbr_mod_param structure

Change-Id: I9412be7b96df2ea62d5f0ec7d709fb45eb3849ce
phadiman 6 năm trước cách đây
mục cha
commit
65eb1b106f

+ 1 - 3
dp/wifi3.0/dp_wdi_event.c

@@ -300,9 +300,7 @@ dp_wdi_event_detach(struct dp_pdev *txrx_pdev)
 		/* Delete all the subscribers */
 		dp_wdi_event_del_subs(wdi_sub, i);
 	}
-	if (txrx_pdev->wdi_event_list) {
-		qdf_mem_free(txrx_pdev->wdi_event_list);
-	}
+	qdf_mem_free(txrx_pdev->wdi_event_list);
 	return 0;
 }
 #endif /* CONFIG_WIN */

+ 7 - 2
target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c

@@ -695,10 +695,15 @@ QDF_STATUS target_if_direct_buf_rx_module_register(
 		direct_buf_rx_err("dir buf rx object is null");
 		return QDF_STATUS_E_FAILURE;
 	}
+
 	direct_buf_rx_info("Dbr pdev obj %pK", dbr_pdev_obj);
 
-	if (!dbr_pdev_obj->dbr_mod_param &&
-	    (mod_id >= dbr_pdev_obj->num_modules)) {
+	if (!dbr_pdev_obj->dbr_mod_param) {
+		direct_buf_rx_err("dbr_pdev_obj->dbr_mod_param is NULL");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (mod_id >= dbr_pdev_obj->num_modules) {
 		direct_buf_rx_err("Module %d not supported in target", mod_id);
 		return QDF_STATUS_E_FAILURE;
 	}