summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2023-03-24 08:44:29 +0100
committerTom Rini <trini@konsulko.com>2023-04-25 15:31:27 -0400
commit45981a9a3759eae8375c85927fb213e4cc14353d (patch)
tree002ab8b48e3ad681a1d46a335b5957eedc5d02fe /drivers
parentc1da6fdb5c239b432440721772d993e63cfdeb20 (diff)
soc: soc_ti_k3: fix revision array bounds checks
If rev is equal to the array size, we'll access the array one-past-the-end. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Bryan Brattlof <bb@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/soc/soc_ti_k3.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/soc/soc_ti_k3.c b/drivers/soc/soc_ti_k3.c
index 42430d79a7a..b720131ae5d 100644
--- a/drivers/soc/soc_ti_k3.c
+++ b/drivers/soc/soc_ti_k3.c
@@ -70,12 +70,12 @@ static const char *get_rev_string(u32 idreg)
switch (soc) {
case JTAG_ID_PARTNO_J721E:
- if (rev > ARRAY_SIZE(j721e_rev_string_map))
+ if (rev >= ARRAY_SIZE(j721e_rev_string_map))
goto bail;
return j721e_rev_string_map[rev];
default:
- if (rev > ARRAY_SIZE(typical_rev_string_map))
+ if (rev >= ARRAY_SIZE(typical_rev_string_map))
goto bail;
return typical_rev_string_map[rev];
};