Re: [PATCH 07/10] of/fdt: Fix the len check in early_init_dt_check_for_usable_mem_range()

From: Geert Uytterhoeven

Date: Wed Nov 12 2025 - 11:48:01 EST


Hi Yuntao,

On Wed, 12 Nov 2025 at 15:38, Yuntao Wang <yuntao.wang@xxxxxxxxx> wrote:
> The len value is in bytes, while `dt_root_addr_cells + dt_root_size_cells`
> is in cells (4 bytes per cell).
>
> The modulo calculation between them is incorrect, the units must be
> converted first.

Thanks for your patch!

> Fixes: fb319e77a0e7 ("of: fdt: Add memory for devices by DT property "linux,usable-memory-range"")

That commit merely changed "<" to "%".

The code that added the bad expression was:
Fixes: 2af2b50acf9b9c38 ("of: fdt: Add generic support for handling
usable memory range property")
However, that code was copied from:
Fixes: 8f579b1c4e347b23 ("arm64: limit memory regions based on DT
property, usable-memory-range")

So I think you want to list these two Fixes-tags instead.

> Signed-off-by: Yuntao Wang <yuntao.wang@xxxxxxxxx>

For the actual change:
Reviewed-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds