From: Marcel Ziswiler Date: Mon, 25 Mar 2019 16:18:29 +0000 (+0100) Subject: tdx-cfg-block: fix off by one issue X-Git-Tag: v2025.01-rc5-pxa1908~3032^2~6 X-Git-Url: http://git.dujemihanovic.xyz/img/static/git-favicon.png?a=commitdiff_plain;h=ccdd37130b3cfe8f11532b0b7b24774e2034acf0;p=u-boot.git tdx-cfg-block: fix off by one issue Fix toradex_modules array off by one issue potentially leading to spurious printout during boot e.g. Model: Toradex V1.2A, instead of Model: Toradex UNKNOWN MODULE V1.2A. Signed-off-by: Marcel Ziswiler Acked-by: Max Krummenacher Reviewed-by: Igor Opaniuk --- diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index 2fcb998ae4..b90077bedc 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -261,7 +261,7 @@ int read_tdx_cfg_block(void) } /* Cap product id to avoid issues with a yet unknown one */ - if (tdx_hw_tag.prodid > (sizeof(toradex_modules) / + if (tdx_hw_tag.prodid >= (sizeof(toradex_modules) / sizeof(toradex_modules[0]))) tdx_hw_tag.prodid = 0;