Преглед изворни кода

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
Naveen Rawat пре 7 година
родитељ
комит
5259c23657
1 измењених фајлова са 6 додато и 4 уклоњено
  1. 6 4
      core/mac/src/pe/lim/lim_process_fils.c

+ 6 - 4
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");