Skip to contentSkip to conversation

phy: qcom: qmp-usbc: Fix out-of-bounds array access in dp swing config

PATCH Applied Xiangxu Yin 4 participants 4 messages Feb 27 – May 19

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: qcom: qmp-usbc: Fix out-of-bounds array access in dp swing config

swing_tbl and pre_emphasis_tbl are 4x4 arrays (valid indices 0-3), but the boundary check uses "> 4" instead of ">= 4", allowing index 4 to cause an out-of-bounds access.

Fixes 81791c45c8e0 ("phy: qcom: qmp-usbc: Add QCS615 USB/DP PHY config and DP mode support")
---
 drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qmp-usbc.c +1 -1
index 14feb77789b3..0dd7000614f4 100644
@@ -794,7 +794,7 @@ static int qmp_v2_configure_dp_swing(struct qmp_usbc *qmp)
 		p_level = max(p_level, dp_opts->pre[i]);
 	}
 
-	if (v_level > 4 || p_level > 4) {
+	if (v_level >= 4 || p_level >= 4) {
 		dev_err(qmp->dev, "Invalid v(%d) | p(%d) level)\n",
 			v_level, p_level);
 		return -EINVAL;

---
base-commit: 7d6661873f6b54c75195780a40d66bad3d482d8f
change-id: 20260227-master-8b948c5633ea

Best regards,

Signature · 1 line
Xiangxu Yin <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · On 2/27/26 1:15 PM, Xiangxu Yin via B4 Relay wrote:

From: Xiangxu Yin <[email protected]>

swing_tbl and pre_emphasis_tbl are 4x4 arrays (valid indices 0-3), but the boundary check uses "> 4" instead of ">= 4", allowing index 4 to cause an out-of-bounds access.

Fixes 81791c45c8e0 ("phy: qcom: qmp-usbc: Add QCS615 USB/DP PHY config and DP mode support")

---

Konrad

Reviewed-by on v1 1/1
#2 lore raw
In reply to Xiangxu Yin
Quoted 6 lines · On Fri, Feb 27, 2026 at 08:15:01PM +0800, Xiangxu Yin via B4 Relay wrote:

From: Xiangxu Yin <[email protected]>

swing_tbl and pre_emphasis_tbl are 4x4 arrays (valid indices 0-3), but the boundary check uses "> 4" instead of ">= 4", allowing index 4 to cause an out-of-bounds access.

Quoted 6 lines
Fixes 81791c45c8e0 ("phy: qcom: qmp-usbc: Add QCS615 USB/DP PHY config and DP mode support")
---
 drivers/phy/qualcomm/phy-qcom-qmp-usbc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
With best wishes
Dmitry
maintainer Applied
#3 lore raw
In reply to Xiangxu Yin
Quoted 5 lines · Xiangxu Yin

swing_tbl and pre_emphasis_tbl are 4x4 arrays (valid indices 0-3), but the boundary check uses "> 4" instead of ">= 4", allowing index 4 to cause an out-of-bounds access.

Applied, thanks!

[1/1] phy: qcom: qmp-usbc: Fix out-of-bounds array access in dp swing config

      commit: ea17fc4d7dc2ba6459b1a318962960520201baf1

Best regards,

Signature · 1 line
~Vinod