All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de, "Marek Behún" <marek.behun@nic.cz>
Subject: [PATCH] malloc_simple: Remove usage of unsupported %zx format string
Date: Thu,  3 Feb 2022 19:51:37 +0100	[thread overview]
Message-ID: <20220203185137.4469-1-pali@kernel.org> (raw)

Replace %zx by %lx and cast size_t to ulong.

U-Boot currently prints garbage debug output:
size=x, ptr=18, limit=18: 4002a000

With this change it prints correct debug data:
size=18, ptr=18, limit=2000: 4002a000

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 common/malloc_simple.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/malloc_simple.c b/common/malloc_simple.c
index 0267fb6bec87..67ee623850e0 100644
--- a/common/malloc_simple.c
+++ b/common/malloc_simple.c
@@ -23,7 +23,7 @@ static void *alloc_simple(size_t bytes, int align)
 
 	addr = ALIGN(gd->malloc_base + gd->malloc_ptr, align);
 	new_ptr = addr + bytes - gd->malloc_base;
-	log_debug("size=%zx, ptr=%lx, limit=%lx: ", bytes, new_ptr,
+	log_debug("size=%lx, ptr=%lx, limit=%lx: ", (ulong)bytes, new_ptr,
 		  gd->malloc_limit);
 	if (new_ptr > gd->malloc_limit) {
 		log_err("alloc space exhausted\n");
-- 
2.20.1


             reply	other threads:[~2022-02-03 18:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03 18:51 Pali Rohár [this message]
2022-02-03 19:25 ` [PATCH] malloc_simple: Remove usage of unsupported %zx format string Sean Anderson
2022-02-03 19:28   ` Sean Anderson
2022-02-03 21:18     ` Tom Rini
2022-02-03 21:19 ` Simon Glass
2022-02-04 10:48   ` Pali Rohár
2022-02-11 17:07 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220203185137.4469-1-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=marek.behun@nic.cz \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.