summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Mittelberg <bmbm@google.com>2022-11-16 16:47:46 -0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-19 02:14:17 +0000
commit1c5c179db16ce361a680f18006b80c1d6e173ec8 (patch)
tree06fc63ea75d08d4b3b6832243c4a3f8e4530d5cf
parent92ee12965a30e88904ee1e72642ea370b32d784c (diff)
downloadchrome-ec-1c5c179db16ce361a680f18006b80c1d6e173ec8.tar.gz
pirika: fix index check
Fix port bound check to avoid out-of-bound access BUG=b:64477774 BRANCH=none TEST=make -j buildall Signed-off-by: Boris Mittelberg <bmbm@google.com> Change-Id: I3571a42ef38adf3a49395c08344182908e479b43 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4032283 Reviewed-by: caveh jalali <caveh@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
-rw-r--r--board/pirika/board.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/board/pirika/board.c b/board/pirika/board.c
index 8913ec0f07..f7c5c0d19b 100644
--- a/board/pirika/board.c
+++ b/board/pirika/board.c
@@ -590,7 +590,7 @@ __override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
__override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
{
- if (port < 0 || port > board_get_usb_pd_port_count())
+ if (!board_is_usb_pd_port_present(port))
return;
raa489000_set_output_current(port, rp);