[PATCH 1/1] tools: fix signature of toc0_verify_cert_item()

Andre Przywara andre.przywara at arm.com
Fri Aug 9 14:28:36 CEST 2024


On Fri,  9 Aug 2024 13:22:16 +0200
Heinrich Schuchardt <heinrich.schuchardt at canonical.com> wrote:

Hi Heinrich,

> Avoid a build warning with GCC 14.2
> 
>     tools/sunxi_toc0.c: In function ‘toc0_verify_cert_item’:
>     tools/sunxi_toc0.c:447:12: warning: ‘nonnull’ argument ‘digest’
>     compared to NULL [-Wnonnull-compare]
>       447 | if (digest && memcmp(&extension->digest, digest, SHA256_DIGEST_LENGTH)) {
>           |    ^
> 
> Use a pointer instead of an array to signal that the argument might be
> NULL.

Seung-Woo Kim sent a different patch for the same problem last week, and
Tom merged it earlier this week:
https://source.denx.de/u-boot/u-boot/-/commit/59fff91f2bea2215c7b16415b9a0e6714fac5573

Thanks for reporting anyways!

Cheers,
Andre

> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>


> ---
>  tools/sunxi_toc0.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/sunxi_toc0.c b/tools/sunxi_toc0.c
> index 292649fe90f..545c3771853 100644
> --- a/tools/sunxi_toc0.c
> +++ b/tools/sunxi_toc0.c
> @@ -412,7 +412,7 @@ err:
>   * This function is only expected to work with images created by mkimage.
>   */
>  static int toc0_verify_cert_item(const uint8_t *buf, uint32_t len, RSA *fw_key,
> -				 uint8_t digest[static SHA256_DIGEST_LENGTH])
> +				 uint8_t *digest)
>  {
>  	const struct toc0_cert_item *cert_item = (const void *)buf;
>  	uint8_t cert_digest[SHA256_DIGEST_LENGTH];



More information about the U-Boot mailing list