]> Gentwo Git Trees - linux/.git/commit
of/fdt: Fix the len check in early_init_dt_check_for_usable_mem_range()
authorYuntao Wang <yuntao.wang@linux.dev>
Sat, 15 Nov 2025 13:47:48 +0000 (21:47 +0800)
committerRob Herring (Arm) <robh@kernel.org>
Thu, 20 Nov 2025 14:32:48 +0000 (08:32 -0600)
commit463942de13cd30fad5dba709f708483eab7efc2c
treeeb75913b3f9f0d002ab4712647f4d8a2c144c349
parentbec5f6092bc1328895992ff02b862ba34b45a0b7
of/fdt: Fix the len check in early_init_dt_check_for_usable_mem_range()

The len value is in bytes, while `dt_root_addr_cells + dt_root_size_cells`
is in cells (4 bytes per cell). Modulo calculation between them is
incorrect, the units must be converted first.

Use helper functions to simplify the code and fix this issue.

Fixes: fb319e77a0e7 ("of: fdt: Add memory for devices by DT property "linux,usable-memory-range"")
Fixes: 2af2b50acf9b9c38 ("of: fdt: Add generic support for handling usable memory range property")
Fixes: 8f579b1c4e347b23 ("arm64: limit memory regions based on DT property, usable-memory-range")
Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
Link: https://patch.msgid.link/20251115134753.179931-4-yuntao.wang@linux.dev
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
drivers/of/fdt.c