]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
of/fdt: Fix the len check in early_init_dt_check_for_elfcorehdr()
authorYuntao Wang <yuntao.wang@linux.dev>
Sat, 15 Nov 2025 13:47:47 +0000 (21:47 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:03:07 +0000 (14:03 +0100)
commitf326efdcab7f826ccd3a0a54cd737b7320444f10
tree6886f0d9266a6b29b28894ce2a4e45ddbaf1abb4
parent7045d5970e16393c1ad3fd1b27c433b6c22c6dee
of/fdt: Fix the len check in early_init_dt_check_for_elfcorehdr()

[ Upstream commit bec5f6092bc1328895992ff02b862ba34b45a0b7 ]

The len value is in bytes, while `dt_root_addr_cells + dt_root_size_cells`
is in cells (4 bytes per cell). Comparing them directly is incorrect.

Use a helper function to simplify the code and address this issue.

Fixes: f7e7ce93aac1 ("of: fdt: Add generic support for handling elf core headers property")
Fixes: e62aaeac426ab1dd ("arm64: kdump: provide /proc/vmcore file")
Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
Link: https://patch.msgid.link/20251115134753.179931-3-yuntao.wang@linux.dev
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/of/fdt.c