diff options
author | Felix Held <felix.held@amd.corp-partner.google.com> | 2020-06-10 19:39:51 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2020-06-11 23:03:54 +0000 |
commit | efd23d92efb982f74b8473201bc93b1c0ad64bc8 (patch) | |
tree | d3086bb1d07a71d73a00161faada9e465365028a | |
parent | ca428c3027cde0844daf823a7621db254ba23ba8 (diff) |
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>
-rw-r--r-- | src/soc/amd/picasso/uart.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/soc/amd/picasso/uart.c b/src/soc/amd/picasso/uart.c index b1331ec603..84d6982968 100644 --- a/src/soc/amd/picasso/uart.c +++ b/src/soc/amd/picasso/uart.c @@ -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); |