
From: He Chuyue <hechuyue@wxiat.com> Sunway inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I56OLG -------------------------------- If kernel image is so large that it corrupts dtb, system will break down early to give a message. Signed-off-by: He Chuyue <hechuyue@wxiat.com> Signed-off-by: Gu Zitao <guzitao@wxiat.com> --- arch/sw_64/kernel/setup.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/sw_64/kernel/setup.c b/arch/sw_64/kernel/setup.c index ca19445ac883..faae7cb3c5a1 100644 --- a/arch/sw_64/kernel/setup.c +++ b/arch/sw_64/kernel/setup.c @@ -565,8 +565,14 @@ static void __init setup_machine_fdt(void) /* Give a chance to select kernel builtin DTB firstly */ if (IS_ENABLED(CONFIG_SW64_BUILTIN_DTB)) dt_virt = (void *)__dtb_start; - else + else { dt_virt = (void *)sunway_boot_params->dtb_start; + if (dt_virt < (void *)__bss_stop) { + pr_emerg("BUG: DTB has been corrupted by kernel image!\n"); + while (true) + cpu_relax(); + } + } phys_addr = __phys_addr((unsigned long)dt_virt); if (!phys_addr_valid(phys_addr) || -- 2.17.1