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

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Fri Aug 9 13:22:16 CEST 2024


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.

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];
-- 
2.45.2



More information about the U-Boot mailing list