mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] commands: bfetch: use 64-bit integer types for sizes
@ 2026-03-29  7:30 Ahmad Fatoum
  2026-04-13  8:12 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2026-03-29  7:30 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

size_human_readable() accepts a 64-bit argument (unsigned long long),
but we pass smaller types into it, leading to truncation when computing
the total sizes for display.

Switch to 64-bit variables to fix this.

Reported-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
---
 commands/bfetch.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/commands/bfetch.c b/commands/bfetch.c
index d9c615f65aca..9dfb07aa2ab7 100644
--- a/commands/bfetch.c
+++ b/commands/bfetch.c
@@ -244,7 +244,7 @@ static struct bobject *print_cpu_mem_info(unsigned *line)
 {
 	struct bobject *bret = NULL;
 	struct memory_bank *mem;
-	unsigned long memsize = 0;
+	u64 memsize = 0;
 	int nbanks = 0;
 	int ret;
 
@@ -565,9 +565,9 @@ static void print_storage(unsigned *line)
 	unsigned nmtds = 0, nnvmem =0;
 	struct block_device *blk;
 	unsigned nblkdevs[BLK_TYPE_COUNT] = {};
-	unsigned blkdev_sizes[BLK_TYPE_COUNT] = {};
+	u64 blkdev_sizes[BLK_TYPE_COUNT] = {};
 	struct mtd_info *mtd;
-	size_t mtd_size = 0, nvmem_size = 0;
+	u64 mtd_size = 0, nvmem_size = 0;
 	struct string_list sl;
 	struct device *dev;
 
-- 
2.47.3




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] commands: bfetch: use 64-bit integer types for sizes
  2026-03-29  7:30 [PATCH] commands: bfetch: use 64-bit integer types for sizes Ahmad Fatoum
@ 2026-04-13  8:12 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-04-13  8:12 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum


On Sun, 29 Mar 2026 09:30:33 +0200, Ahmad Fatoum wrote:
> size_human_readable() accepts a 64-bit argument (unsigned long long),
> but we pass smaller types into it, leading to truncation when computing
> the total sizes for display.
> 
> Switch to 64-bit variables to fix this.
> 
> 
> [...]

Applied, thanks!

[1/1] commands: bfetch: use 64-bit integer types for sizes
      https://git.pengutronix.de/cgit/barebox/commit/?id=18a66f3dd416 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-13  8:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-29  7:30 [PATCH] commands: bfetch: use 64-bit integer types for sizes Ahmad Fatoum
2026-04-13  8:12 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox