[PATCH 57/67] upl: Correct use of sizeof()

Simon Glass sjg at chromium.org
Wed Jan 1 23:09:43 CET 2025


The write_mem_node() function uses sizeof(64) when sizeof(u64) is
intended. This can cause an error due to the buffer-space being
exhausted.

Correct this.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 boot/upl_write.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/boot/upl_write.c b/boot/upl_write.c
index ec1f5daac92..773c03ad1c6 100644
--- a/boot/upl_write.c
+++ b/boot/upl_write.c
@@ -336,7 +336,7 @@ static int write_mem_node(const struct upl *upl, ofnode parent,
 			  const struct alist *mem, const char *leaf,
 			  ofnode *nodep)
 {
-	char buf[mem->count * sizeof(64) * 2];
+	char buf[mem->count * sizeof(u64) * 2];
 	const struct memregion *first;
 	char name[26];
 	ofnode node;
-- 
2.43.0



More information about the U-Boot mailing list