soc/amd/picasso/uart: fix possible out of bounds access

Found-by: Coverity CID 1429769, 1429777

Change-Id: Ide188379a34c769c929bf7832fd94a7004c09a64
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/42253
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Felix Held 2020-06-10 19:39:51 +02:00 committed by Felix Held
parent ca428c3027
commit efd23d92ef
1 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ static const struct _uart_info {
uintptr_t uart_platform_base(int idx)
{
if (idx < 0 || idx > ARRAY_SIZE(uart_info))
if (idx < 0 || idx >= ARRAY_SIZE(uart_info))
return 0;
return uart_info[idx].base;
@ -43,7 +43,7 @@ void set_uart_config(int idx)
uint32_t uart_ctrl;
uint16_t uart_leg;
if (idx < 0 || idx > ARRAY_SIZE(uart_info))
if (idx < 0 || idx >= ARRAY_SIZE(uart_info))
return;
program_gpios(uart_info[idx].mux, 2);