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:
parent
ca428c3027
commit
efd23d92ef
|
@ -32,7 +32,7 @@ static const struct _uart_info {
|
||||||
|
|
||||||
uintptr_t uart_platform_base(int idx)
|
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 0;
|
||||||
|
|
||||||
return uart_info[idx].base;
|
return uart_info[idx].base;
|
||||||
|
@ -43,7 +43,7 @@ void set_uart_config(int idx)
|
||||||
uint32_t uart_ctrl;
|
uint32_t uart_ctrl;
|
||||||
uint16_t uart_leg;
|
uint16_t uart_leg;
|
||||||
|
|
||||||
if (idx < 0 || idx > ARRAY_SIZE(uart_info))
|
if (idx < 0 || idx >= ARRAY_SIZE(uart_info))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
program_gpios(uart_info[idx].mux, 2);
|
program_gpios(uart_info[idx].mux, 2);
|
||||||
|
|
Loading…
Reference in New Issue