qcacmn: Add null pointer validation and fix initialization in dfs

Add validation check for memory allocation and initialize variable
before using.

Change-Id: If5215f4f034ea57884b252f8467c4e2ca227c952
CRs-Fixed: 2160749
This commit is contained in:
Arif Hussain 2017-12-20 16:29:10 -08:00 • committed by snandini
commit 5e7ad9b03f
3 changed files with 10 additions and 7 deletions

View file

@ -293,10 +293,8 @@ bad1:
qdf_mem_free(dfs->pulses);
dfs->pulses = NULL;
}
if (dfs->events) {
qdf_mem_free(dfs->events);
dfs->events = NULL;
}
qdf_mem_free(dfs->events);
dfs->events = NULL;
return 1;
}

View file

@ -534,6 +534,11 @@ void dfs_init_precac_list(struct wlan_dfs *dfs)
precac_entry = qdf_mem_malloc(
sizeof(*precac_entry));
if (!precac_entry) {
dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
"entry alloc fail for : %d", i);
continue;
}
precac_entry->vht80_freq =
ichan->dfs_ch_vhtop_ch_freq_seg1;
precac_entry->dfs = dfs;

View file

@ -209,7 +209,7 @@ QDF_STATUS wlan_dfs_pdev_obj_create_notification(struct wlan_objmgr_pdev *pdev,
QDF_STATUS wlan_dfs_pdev_obj_destroy_notification(struct wlan_objmgr_pdev *pdev,
void *arg)
{
struct wlan_dfs *dfs;
struct wlan_dfs *dfs = NULL;
if (!pdev) {
dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "PDEV is NULL");
@ -219,7 +219,7 @@ QDF_STATUS wlan_dfs_pdev_obj_destroy_notification(struct wlan_objmgr_pdev *pdev,
dfs = wlan_pdev_get_dfs_obj(pdev);
/* DFS is NULL during unload. should we call this function before */
if (dfs != NULL) {
if (dfs) {
global_dfs_to_mlme.pdev_component_obj_detach(pdev,
WLAN_UMAC_COMP_DFS,
(void *)dfs);
@ -237,7 +237,7 @@ static void dfs_scan_serialization_comp_info_cb(
struct wlan_objmgr_vdev *vdev,
union wlan_serialization_rules_info *comp_info)
{
struct wlan_dfs *dfs;
struct wlan_dfs *dfs = NULL;
struct wlan_objmgr_pdev *pdev;
if (!comp_info) {