From de66e665170ffc60a750f43601f0e4d66b386b76 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Tue, 15 Feb 2022 14:11:36 -0700 Subject: [PATCH] soc/amd/cezanne/psp_verstage/uart: Fix off by 1 error We only allow index = {0, 1}. Fix the check. BUG=b:215599230 TEST=Build guybrush BRANCH=guybrush Found-by: Coverity CID 1469611 Signed-off-by: Raul E Rangel Change-Id: I59615ab39faeded43b3803b4450c84ab8a8b81ba Reviewed-on: https://review.coreboot.org/c/coreboot/+/61988 Reviewed-by: Felix Held Tested-by: build bot (Jenkins) --- src/soc/amd/cezanne/psp_verstage/uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/soc/amd/cezanne/psp_verstage/uart.c b/src/soc/amd/cezanne/psp_verstage/uart.c index 5a45cb0545..2767b2eb27 100644 --- a/src/soc/amd/cezanne/psp_verstage/uart.c +++ b/src/soc/amd/cezanne/psp_verstage/uart.c @@ -10,7 +10,7 @@ uintptr_t get_uart_base(unsigned int idx) { uint32_t err; - if (idx > ARRAY_SIZE(uart_bars)) + if (idx >= ARRAY_SIZE(uart_bars)) return 0; if (uart_bars[idx])