summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <pgeorgi@google.com>2019-09-12 15:02:47 +0200
committerCommit Bot <commit-bot@chromium.org>2019-09-12 23:36:53 +0000
commitf2086e771d940b35d86e5adcaf21ffe3035e71d2 (patch)
treecdf9224f56ea724fdc6b08331fe5675b7b5f0f6d
parent3e7d997d6832487be0ddcf80740b90d047a18d79 (diff)
downloadchrome-ec-f2086e771d940b35d86e5adcaf21ffe3035e71d2.tar.gz
driver/tcpm/anx7447: bound port argument
Found by Coverity Scan #187773, #204053 BUG=none BRANCH=none TEST=none Change-Id: Ie7006828d8a5d760097baade6851c72d15e42cf1 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1801206 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Patrick Georgi <pgeorgi@chromium.org> Commit-Queue: Patrick Georgi <pgeorgi@chromium.org>
-rw-r--r--driver/tcpm/anx7447.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/driver/tcpm/anx7447.c b/driver/tcpm/anx7447.c
index ebefe785cc..4753a6d5d8 100644
--- a/driver/tcpm/anx7447.c
+++ b/driver/tcpm/anx7447.c
@@ -285,6 +285,8 @@ static int anx7447_init(int port)
{
int rv, reg, i;
+ ASSERT(port < CONFIG_USB_PD_PORT_COUNT);
+
memset(&anx[port], 0, sizeof(struct anx_state));
/*
@@ -491,6 +493,8 @@ void anx7447_tcpc_clear_hpd_status(int port)
#ifdef CONFIG_USB_PD_TCPM_MUX
static int anx7447_mux_init(int port)
{
+ ASSERT(port < CONFIG_USB_PD_PORT_COUNT);
+
memset(&mux[port], 0, sizeof(struct anx_usb_mux));
/* init hpd status */