소스 검색

qcacmn: Fix uninitialized var ptr issue and null check for num_pscos

1.This change fixes the use of uninitialized
variable in host driver.

2.Adds NULL check for num_psocs in mlo_peer_calculate_avg_rssi to
avoid undefined behaviour.

Change-Id: Ifbfef42b5930dfe15736a75a74e81155c5f1fbce
CRs-Fixed: 3297794
Asutosh Mohapatra 2 년 전
부모
커밋
9ab40cb89e
2개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      target_if/spectral/target_if_spectral_phyerr.c
  2. 3 0
      umac/mlo_mgr/src/wlan_mlo_mgr_primary_umac.c

+ 1 - 1
target_if/spectral/target_if_spectral_phyerr.c

@@ -4043,7 +4043,7 @@ int target_if_spectral_process_report_gen3(
 	int ret = 0;
 	struct direct_buf_rx_data *payload = buf;
 	struct target_if_spectral *spectral;
-	struct spectral_report report;
+	struct spectral_report report = {0};
 	int samp_msg_index;
 	struct spectral_data_stats *spectral_dp_stats;
 

+ 3 - 0
umac/mlo_mgr/src/wlan_mlo_mgr_primary_umac.c

@@ -361,6 +361,9 @@ static void mlo_peer_calculate_avg_rssi(
 								 rssi);
 	}
 
+	if (!num_psocs)
+		return;
+
 	ml_peer->avg_link_rssi = total_rssi / num_psocs;
 }