From b73471e4e7779c9566edb3e8846c9cdfee99b008 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 11 May 2021 11:08:04 +0200 Subject: [PATCH] Revert "ANDROID: usb: typec: ucsi: Ensure bounds check when accessing src_pdos" This reverts commit cd04f7fab9902abcf5adbc2f83b42fa3c3d032f9. It will be fixed "properly" with an upstream patch later on in this series, so revert it now so that it does not cause conflicts with the upstream commit. Bug: 186400956 Cc: Subbaraman Narayanamurthy Signed-off-by: Greg Kroah-Hartman Change-Id: I111e570ce5e2447c639723430e86c98c040171b1 --- drivers/usb/typec/ucsi/psy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/typec/ucsi/psy.c b/drivers/usb/typec/ucsi/psy.c index 387ba85764b1..571a51e16234 100644 --- a/drivers/usb/typec/ucsi/psy.c +++ b/drivers/usb/typec/ucsi/psy.c @@ -69,7 +69,7 @@ static int ucsi_psy_get_voltage_max(struct ucsi_connector *con, switch (UCSI_CONSTAT_PWR_OPMODE(con->status.flags)) { case UCSI_CONSTAT_PWR_OPMODE_PD: - if (con->num_pdos > 0 && con->num_pdos <= UCSI_MAX_PDOS) { + if (con->num_pdos > 0) { pdo = con->src_pdos[con->num_pdos - 1]; val->intval = pdo_fixed_voltage(pdo) * 1000; } else { @@ -98,7 +98,7 @@ static int ucsi_psy_get_voltage_now(struct ucsi_connector *con, switch (UCSI_CONSTAT_PWR_OPMODE(con->status.flags)) { case UCSI_CONSTAT_PWR_OPMODE_PD: index = rdo_index(con->rdo); - if (index > 0 && index <= UCSI_MAX_PDOS) { + if (index > 0) { pdo = con->src_pdos[index - 1]; val->intval = pdo_fixed_voltage(pdo) * 1000; } else { @@ -125,7 +125,7 @@ static int ucsi_psy_get_current_max(struct ucsi_connector *con, switch (UCSI_CONSTAT_PWR_OPMODE(con->status.flags)) { case UCSI_CONSTAT_PWR_OPMODE_PD: - if (con->num_pdos > 0 && con->num_pdos <= UCSI_MAX_PDOS) { + if (con->num_pdos > 0) { pdo = con->src_pdos[con->num_pdos - 1]; val->intval = pdo_max_current(pdo) * 1000; } else {