[PATCH v2] display_options: print_size: Fix order overflow
Simon Glass
sjg at chromium.org
Wed Sep 14 19:10:34 CEST 2022
On Mon, 12 Sept 2022 at 13:03, Pali Rohár <pali at kernel.org> wrote:
>
> Function print_size() round size to the nearst value with one decimal
> fraction number. But in special cases also unit order may overflow.
>
> For example value 1073689396 is printed as "1024 MiB" and value 1073741824
> as "1 GiB".
>
> Fix this issue by detecting order overflow and increasing unit order.
> With this change also value 1073689396 is printed as "1 GiB".
>
> Signed-off-by: Pali Rohár <pali at kernel.org>
>
> ---
> Changes in v2:
> * Add unit test case
> ---
> lib/display_options.c | 6 ++++++
> test/lib/test_print.c | 3 +++
> 2 files changed, 9 insertions(+)
Reviewed-by: Simon Glass <sjg at chromium.org>
More information about the U-Boot
mailing list