mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
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>
This commit is contained in:
parent
c1da6fdb5c
commit
45981a9a37
1 changed files with 2 additions and 2 deletions
|
@ -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];
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue