From: Ye Bin yebin10@huawei.com
hulk inclusion category: bugfix bugzilla: 185870 https://gitee.com/openeuler/kernel/issues/I4M8IW?from=project-issue CVE: NA
-----------------------------------------------------------
The maximum linear address is U32_MAX, when enabled kaslr, A small value should be taken between end_addr of initrd and U32_MAX when calculating the size of initrd.
Fixes: c1a0cdb549be ("ARM: decompressor: add KASLR support") Signed-off-by: Ye Bin yebin10@huawei.com Signed-off-by: yangerkun yangerkun@huawei.com Signed-off-by: Cui GaoSheng cuigaosheng1@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/arm/boot/compressed/kaslr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boot/compressed/kaslr.c b/arch/arm/boot/compressed/kaslr.c index ff81a2c31233..3b37c0441574 100644 --- a/arch/arm/boot/compressed/kaslr.c +++ b/arch/arm/boot/compressed/kaslr.c @@ -410,7 +410,7 @@ u32 kaslr_early_init(u32 *kaslr_offset, u32 image_base, u32 image_size, } if (start != 0 && end != 0 && start < U32_MAX) { regions.initrd_start = start; - regions.initrd_size = max_t(u64, end, U32_MAX) - start; + regions.initrd_size = min_t(u64, end, U32_MAX) - start; } }