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>
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];
};