瀏覽代碼

qcacmn: Fix division by 0 in dp_get_kbps_to_mcs

For cases DP_11B_CCK_RATE, DP_11A_OFDM_RATE and
DP_11G_CCK_OFDM_RATE, variable num_mcs is not set and is
assigned 0 which is used as a divisor to get the MCS value.
To fix this, return 0 for above mentioned cases.

Change-Id: Ic1d2dce93a3aa55c323e1f75d30c5f9371822280
CRs-Fixed: 3479813
Ananya Gupta 2 年之前
父節點
當前提交
3c19803152
共有 1 個文件被更改,包括 5 次插入12 次删除
  1. 5 12
      dp/cmn_dp_api/dp_ratetable.c

+ 5 - 12
dp/cmn_dp_api/dp_ratetable.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016-2019, 2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -7011,21 +7011,14 @@ int dp_get_kbps_to_mcs(int kbps_rate, int shortgi, int htflag)
 	switch (htflag) {
 	/* 11b CCK Rates */
 	case DP_11B_CCK_RATE:
-		start_index = CCK_RATE_TABLE_INDEX;
-		end_index = CCK_RATE_TABLE_END_INDEX;
-		break;
-
+		fallthrough;
 	/* 11a OFDM Rates */
 	case DP_11A_OFDM_RATE:
-		start_index = OFDM_RATE_TABLE_INDEX;
-		end_index = OFDMA_RATE_TABLE_END_INDEX;
-		break;
-
+		fallthrough;
 	/* 11g CCK/OFDM Rates */
 	case DP_11G_CCK_OFDM_RATE:
-		start_index = CCK_RATE_TABLE_INDEX;
-		end_index = OFDMA_RATE_TABLE_END_INDEX;
-		break;
+	/* These rates dont have corresponding MCS, hence return 0 */
+		return 0;
 
 	/* HT rates only */
 	case DP_HT_RATE: