From: Rasmus Villemoes Date: Fri, 24 Mar 2023 07:44:29 +0000 (+0100) Subject: soc: soc_ti_k3: fix revision array bounds checks X-Git-Tag: v2023.07~77^2~30 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=45981a9a3759eae8375c85927fb213e4cc14353d;p=platform%2Fkernel%2Fu-boot.git 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 Reviewed-by: Bryan Brattlof --- diff --git a/drivers/soc/soc_ti_k3.c b/drivers/soc/soc_ti_k3.c index 42430d7..b720131 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]; };