Browse Source

qcacmn: Validate nbuf in dp trace function

Validate nbuf before processing in dp trace function

Change-Id: Idb59f83edc09f9be8bf0bd231b8eb6ff28f37fd4
CRs-Fixed: 2213737
Kabilan Kannan 7 years ago
parent
commit
d6c4f2209c
1 changed files with 6 additions and 4 deletions
  1. 6 4
      qdf/linux/src/qdf_trace.c

+ 6 - 4
qdf/linux/src/qdf_trace.c

@@ -1194,10 +1194,12 @@ static bool qdf_dp_enable_check(qdf_nbuf_t nbuf, enum QDF_DP_TRACE_ID code,
 	if (qdf_dp_trace_enable_track(code) == false)
 		return false;
 
-	if ((nbuf) && ((QDF_NBUF_CB_TX_PACKET_TRACK(nbuf) !=
-		 QDF_NBUF_TX_PKT_DATA_TRACK) ||
-		 ((dir == QDF_TX) && (QDF_NBUF_CB_TX_DP_TRACE(nbuf) == 0)) ||
-		 ((dir == QDF_RX) && (QDF_NBUF_CB_RX_DP_TRACE(nbuf) == 0))))
+	if (!nbuf)
+		return false;
+
+	if ((QDF_NBUF_CB_TX_PACKET_TRACK(nbuf) != QDF_NBUF_TX_PKT_DATA_TRACK) ||
+	    ((dir == QDF_TX) && (QDF_NBUF_CB_TX_DP_TRACE(nbuf) == 0)) ||
+	    ((dir == QDF_RX) && (QDF_NBUF_CB_RX_DP_TRACE(nbuf) == 0)))
 		return false;
 
 	return true;