瀏覽代碼

qcacmn: Compilation fixes for SM8150 platform

1. Address out of bounds array access while
   populating mcs rates.
2. Use cdp_sec_type enum inplace of htt_sec_type
   for common code.

Change-Id: I0ae1e0acaf7422e73dc26befc9f066f3f424ec6b
CRs-Fixed: 2327153
Venkata Sharath Chandra Manchala 6 年之前
父節點
當前提交
d18887ee9f
共有 8 個文件被更改,包括 27 次插入27 次删除
  1. 2 2
      dp/wifi3.0/dp_htt.c
  2. 4 5
      dp/wifi3.0/dp_main.c
  3. 2 2
      dp/wifi3.0/dp_peer.c
  4. 1 1
      dp/wifi3.0/dp_peer.h
  5. 5 8
      dp/wifi3.0/dp_rx.c
  6. 6 6
      dp/wifi3.0/dp_rx_defrag.c
  7. 6 2
      dp/wifi3.0/dp_tx.c
  8. 1 1
      dp/wifi3.0/dp_types.h

+ 2 - 2
dp/wifi3.0/dp_htt.c

@@ -2981,7 +2981,7 @@ static void dp_htt_t2h_msg_handler(void *context, HTC_PACKET *pkt)
 	case HTT_T2H_MSG_TYPE_SEC_IND:
 		{
 			u_int16_t peer_id;
-			enum htt_sec_type sec_type;
+			enum cdp_sec_type sec_type;
 			int is_unicast;
 
 			peer_id = HTT_SEC_IND_PEER_ID_GET(*msg_word);
@@ -3178,7 +3178,7 @@ dp_htt_h2t_full(void *context, HTC_PACKET *pkt)
 static QDF_STATUS
 dp_htt_hif_t2h_hp_callback (void *context, qdf_nbuf_t nbuf, uint8_t pipe_id)
 {
-	A_STATUS rc = QDF_STATUS_SUCCESS;
+	QDF_STATUS rc = QDF_STATUS_SUCCESS;
 	HTC_PACKET htc_pkt;
 
 	qdf_assert_always(pipe_id == DP_HTT_T2H_HP_PIPE);

+ 4 - 5
dp/wifi3.0/dp_main.c

@@ -5021,9 +5021,8 @@ static void dp_get_peer_mac_from_peer_id(struct cdp_pdev *pdev_handle,
 	if (pdev && peer_mac) {
 		peer = dp_peer_find_by_id(pdev->soc, (uint16_t)peer_id);
 		if (peer) {
-			if (peer->mac_addr.raw)
-				qdf_mem_copy(peer_mac, peer->mac_addr.raw,
-					     DP_MAC_ADDR_LEN);
+			qdf_mem_copy(peer_mac, peer->mac_addr.raw,
+				     DP_MAC_ADDR_LEN);
 			dp_peer_unref_del_find_by_id(peer);
 		}
 	}
@@ -7140,7 +7139,7 @@ dp_txrx_stats_publish(struct cdp_pdev *pdev_handle, void *buf)
 	struct cdp_txrx_stats_req req = {0,};
 
 	dp_aggregate_pdev_stats(pdev);
-	req.stats = HTT_DBG_EXT_STATS_PDEV_TX;
+	req.stats = (enum cdp_stats)HTT_DBG_EXT_STATS_PDEV_TX;
 	req.cookie_val = 1;
 	dp_h2t_ext_stats_msg_send(pdev, req.stats, req.param0,
 				req.param1, req.param2, req.param3, 0,
@@ -7148,7 +7147,7 @@ dp_txrx_stats_publish(struct cdp_pdev *pdev_handle, void *buf)
 
 	msleep(DP_MAX_SLEEP_TIME);
 
-	req.stats = HTT_DBG_EXT_STATS_PDEV_RX;
+	req.stats = (enum cdp_stats)HTT_DBG_EXT_STATS_PDEV_RX;
 	req.cookie_val = 1;
 	dp_h2t_ext_stats_msg_send(pdev, req.stats, req.param0,
 				req.param1, req.param2, req.param3, 0,

+ 2 - 2
dp/wifi3.0/dp_peer.c

@@ -2394,7 +2394,7 @@ dp_set_pn_check_wifi3(struct cdp_vdev *vdev_handle, struct cdp_peer *peer_handle
 
 void
 dp_rx_sec_ind_handler(void *soc_handle, uint16_t peer_id,
-	enum htt_sec_type sec_type, int is_unicast, u_int32_t *michael_key,
+	enum cdp_sec_type sec_type, int is_unicast, u_int32_t *michael_key,
 	u_int32_t *rx_pn)
 {
 	struct dp_soc *soc = (struct dp_soc *)soc_handle;
@@ -2434,7 +2434,7 @@ dp_rx_sec_ind_handler(void *soc_handle, uint16_t peer_id,
 #endif
 
 #ifdef notyet /* TODO: Check if this is required for wifi3.0 */
-	if (sec_type != htt_sec_type_wapi) {
+	if (sec_type != cdp_sec_type_wapi) {
 		qdf_mem_set(peer->tids_last_pn_valid, _EXT_TIDS, 0x00);
 	} else {
 		for (i = 0; i < DP_MAX_TIDS; i++) {

+ 1 - 1
dp/wifi3.0/dp_peer.h

@@ -95,7 +95,7 @@ void dp_rx_peer_unmap_handler(void *soc_handle, uint16_t peer_id,
 			      uint8_t vdev_id, uint8_t *peer_mac_addr,
 			      uint8_t is_wds);
 void dp_rx_sec_ind_handler(void *soc_handle, uint16_t peer_id,
-	enum htt_sec_type sec_type, int is_unicast,
+	enum cdp_sec_type sec_type, int is_unicast,
 	u_int32_t *michael_key, u_int32_t *rx_pn);
 uint8_t dp_get_peer_mac_addr_frm_id(struct cdp_soc_t *soc_handle,
 		uint16_t peer_id, uint8_t *peer_mac);

+ 5 - 8
dp/wifi3.0/dp_rx.c

@@ -865,9 +865,6 @@ free:
 void dp_rx_process_invalid_peer_wrapper(struct dp_soc *soc,
 					qdf_nbuf_t mpdu, bool mpdu_done)
 {
-	/* To avoid compiler warning */
-	mpdu_done = mpdu_done;
-
 	/* Process the nbuf */
 	dp_rx_process_invalid_peer(soc, mpdu);
 }
@@ -1195,23 +1192,23 @@ static void dp_rx_msdu_stats_update(struct dp_soc *soc,
 	DP_STATS_INC(peer, rx.wme_ac_type[TID_TO_WME_AC(tid)], 1);
 	DP_STATS_INC(peer, rx.reception_type[reception_type], 1);
 
-	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS], 1,
+	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS - 1], 1,
 		      ((mcs >= MAX_MCS_11A) && (pkt_type == DOT11_A)));
 	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1,
 		      ((mcs <= MAX_MCS_11A) && (pkt_type == DOT11_A)));
-	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS], 1,
+	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS - 1], 1,
 		      ((mcs >= MAX_MCS_11B) && (pkt_type == DOT11_B)));
 	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1,
 		      ((mcs <= MAX_MCS_11B) && (pkt_type == DOT11_B)));
-	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS], 1,
+	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS - 1], 1,
 		      ((mcs >= MAX_MCS_11A) && (pkt_type == DOT11_N)));
 	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1,
 		      ((mcs <= MAX_MCS_11A) && (pkt_type == DOT11_N)));
-	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS], 1,
+	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS - 1], 1,
 		      ((mcs >= MAX_MCS_11AC) && (pkt_type == DOT11_AC)));
 	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1,
 		      ((mcs <= MAX_MCS_11AC) && (pkt_type == DOT11_AC)));
-	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS], 1,
+	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[MAX_MCS - 1], 1,
 		      ((mcs >= MAX_MCS) && (pkt_type == DOT11_AX)));
 	DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1,
 		      ((mcs <= MAX_MCS) && (pkt_type == DOT11_AX)));

+ 6 - 6
dp/wifi3.0/dp_rx_defrag.c

@@ -1156,10 +1156,10 @@ static QDF_STATUS dp_rx_defrag(struct dp_peer *peer, unsigned tid,
 			index, peer->security[index].sec_type);
 
 	switch (peer->security[index].sec_type) {
-	case htt_sec_type_tkip:
+	case cdp_sec_type_tkip:
 		tkip_demic = 1;
 
-	case htt_sec_type_tkip_nomic:
+	case cdp_sec_type_tkip_nomic:
 		while (cur) {
 			tmp_next = qdf_nbuf_next(cur);
 			if (dp_rx_defrag_tkip_decap(cur, hdr_space)) {
@@ -1177,7 +1177,7 @@ static QDF_STATUS dp_rx_defrag(struct dp_peer *peer, unsigned tid,
 		hdr_space += dp_f_tkip.ic_header;
 		break;
 
-	case htt_sec_type_aes_ccmp:
+	case cdp_sec_type_aes_ccmp:
 		while (cur) {
 			tmp_next = qdf_nbuf_next(cur);
 			if (dp_rx_defrag_ccmp_demic(cur, hdr_space)) {
@@ -1203,9 +1203,9 @@ static QDF_STATUS dp_rx_defrag(struct dp_peer *peer, unsigned tid,
 		hdr_space += dp_f_ccmp.ic_header;
 		break;
 
-	case htt_sec_type_wep40:
-	case htt_sec_type_wep104:
-	case htt_sec_type_wep128:
+	case cdp_sec_type_wep40:
+	case cdp_sec_type_wep104:
+	case cdp_sec_type_wep128:
 		while (cur) {
 			tmp_next = qdf_nbuf_next(cur);
 			if (dp_rx_defrag_wep_decap(cur, hdr_space)) {

+ 6 - 2
dp/wifi3.0/dp_tx.c

@@ -2573,8 +2573,10 @@ dp_tx_update_peer_stats(struct dp_peer *peer,
 	mcs = ts->mcs;
 	pkt_type = ts->pkt_type;
 
-	if (!ts->release_src == HAL_TX_COMP_RELEASE_SOURCE_TQM)
+	if (ts->release_src != HAL_TX_COMP_RELEASE_SOURCE_TQM) {
+		dp_err("Release source is not from TQM");
 		return;
+	}
 
 	DP_STATS_INCC(peer, tx.dropped.age_out, 1,
 		     (ts->status == HAL_TX_TQM_RR_REM_CMD_AGED));
@@ -2597,8 +2599,10 @@ dp_tx_update_peer_stats(struct dp_peer *peer,
 	DP_STATS_INCC(peer, tx.dropped.fw_reason3, 1,
 		     (ts->status == HAL_TX_TQM_RR_FW_REASON3));
 
-	if (!ts->status == HAL_TX_TQM_RR_FRAME_ACKED)
+	if (ts->status != HAL_TX_TQM_RR_FRAME_ACKED) {
+		dp_err("Tx completion has no valid acknowledgment");
 		return;
+	}
 
 	DP_STATS_INCC(peer, tx.ofdma, 1, ts->ofdma);
 

+ 1 - 1
dp/wifi3.0/dp_types.h

@@ -1507,7 +1507,7 @@ struct dp_peer {
 	/* TBD: No transmit TID state required? */
 
 	struct {
-		enum htt_sec_type sec_type;
+		enum cdp_sec_type sec_type;
 		u_int32_t michael_key[2]; /* relevant for TKIP */
 	} security[2]; /* 0 -> multicast, 1 -> unicast */