UPSTREAM: cpu/ti/am355x: Fix array overrun
> Overrunning array "am335x_gpio_banks" of 4 4-byte elements at element > index 4 (byte offset 16) using index "bank" (which evaluates to 4). As the first index is 0, also error out if the index is equal the array size. BUG=None BRANCH=None TEST=None Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de> Reviewed-on: https://review.coreboot.org/16165 Reviewed-by: Patrick Georgi <pgeorgi@google.com> Change-Id: I6b6b6e010348a58931bd546dfc54f08460e8dbbc Reviewed-on: https://chromium-review.googlesource.com/370702 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
116b54b9e0
commit
c4320afe04
1 changed files with 1 additions and 1 deletions
|
|
@ -22,7 +22,7 @@ static struct am335x_gpio_regs *gpio_regs_and_bit(unsigned gpio, uint32_t *bit)
|
|||
{
|
||||
unsigned bank = gpio / AM335X_GPIO_BITS_PER_BANK;
|
||||
|
||||
if (bank > ARRAY_SIZE(am335x_gpio_banks)) {
|
||||
if (bank >= ARRAY_SIZE(am335x_gpio_banks)) {
|
||||
printk(BIOS_ERR, "Bad gpio index %d.\n", gpio);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue