From 5259c236571fd7adfed9dc006cea9ceb02c59727 Mon Sep 17 00:00:00 2001 From: Naveen Rawat Date: Mon, 30 Apr 2018 14:43:47 -0700 Subject: [PATCH] qcacld-3.0: Fix NPD in function lim_create_fils_wrapper_data Fix NPD in function lim_create_fils_wrapper_data, by moving the check against NULL pointer before the access. Change-Id: I00c6c4df0ff94ffdfe77a8a563b1747c29906b2f CRs-Fixed: 2232734 --- core/mac/src/pe/lim/lim_process_fils.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/mac/src/pe/lim/lim_process_fils.c b/core/mac/src/pe/lim/lim_process_fils.c index 3a64855841b5..165a64561275 100644 --- a/core/mac/src/pe/lim/lim_process_fils.c +++ b/core/mac/src/pe/lim/lim_process_fils.c @@ -863,7 +863,12 @@ static int lim_create_fils_wrapper_data(struct pe_fils_session *fils_info) uint8_t auth_tag[FILS_AUTH_TAG_MAX_LENGTH] = {0}; uint32_t length = 0; QDF_STATUS status; - int buf_len = + int buf_len; + + if (!fils_info) + return 0; + + buf_len = /* code + identifier */ sizeof(uint8_t) * 2 + /* length */ @@ -877,9 +882,6 @@ static int lim_create_fils_wrapper_data(struct pe_fils_session *fils_info) /* cryptosuite + auth_tag */ sizeof(uint8_t) + lim_get_auth_tag_len(HMAC_SHA256_128); - if (!fils_info) - return 0; - fils_info->fils_erp_reauth_pkt = qdf_mem_malloc(buf_len); if (!fils_info->fils_erp_reauth_pkt) { pe_err("failed to allocate memory");