提交 a67342ed 编写于 作者: Y Ye Bin 提交者: Zheng Zengkai

arm: kaslr: Fix memtop calculate, when there is no memory top info, we can't use zero instead it.

hulk inclusion
commit 88bf5c03832d56c68fac61e4ae97158b3332bd63
category: feature
feature: ARM kaslr support
bugzilla: 47952
CVE: NA

-------------------------------------------------

Fix memtop calculate, when there is no memory top info,
we can't use zero instead it.
Signed-off-by: NYe Bin <yebin10@huawei.com>
Reviewed-by: NJing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NCui GaoSheng <cuigaosheng1@huawei.com>
Reviewed-by: NXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 1cd67b23
......@@ -316,7 +316,7 @@ u32 kaslr_early_init(u32 *kaslr_offset, u32 image_base, u32 image_size,
const char *command_line;
const char *p;
int chosen, len;
u32 lowmem_top, count, num;
u32 lowmem_top, count, num, mem_fdt;
if (IS_ENABLED(CONFIG_EFI_STUB)) {
extern u32 __efi_kaslr_offset;
......@@ -400,8 +400,11 @@ u32 kaslr_early_init(u32 *kaslr_offset, u32 image_base, u32 image_size,
}
/* check the memory nodes for the size of the lowmem region */
regions.pa_end = min(regions.pa_end, get_memory_end(fdt)) -
regions.image_size;
mem_fdt = get_memory_end(fdt);
if (mem_fdt)
regions.pa_end = min(regions.pa_end, mem_fdt) - regions.image_size;
else
regions.pa_end = regions.pa_end - regions.image_size;
puthex32(regions.image_size);
puthex32(regions.pa_start);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册