Skip to content

Commit

Permalink
cutils: Fix size_to_str() on 32-bit platforms
Browse files Browse the repository at this point in the history
When extracting a human-readable size formatter, we changed 'uint64_t
div' pre-patch to 'unsigned long div' post-patch. Which breaks on
32-bit platforms, resulting in 'inf' instead of intended values larger
than 999GB.

Fixes: 22951aa
CC: qemu-stable@nongnu.org
Reported-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
  • Loading branch information
ebblake authored and kevmw committed Apr 30, 2019
1 parent 0cb98af commit 754da86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util/cutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ const char *qemu_ether_ntoa(const MACAddr *mac)
char *size_to_str(uint64_t val)
{
static const char *suffixes[] = { "", "Ki", "Mi", "Gi", "Ti", "Pi", "Ei" };
unsigned long div;
uint64_t div;
int i;

/*
Expand Down

0 comments on commit 754da86

Please sign in to comment.