mirror of
https://gitee.com/open-loongarch/linux-6.12.git
synced 2026-10-25 20:47:11 +08:00
LoongArch: Use unsigned long for _end and _text
It is better to use unsigned long rather than long for _end and _text to calculate the kernel length. Cc: stable@vger.kernel.org # v6.3+ Fixes: e5f02b51fa0c ("LoongArch: Add support for kernel address space layout randomization (KASLR)") Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: maoxiaochuan <maoxiaochuan@loongson.cn>
This commit is contained in:
committed by
maoxiaochuan
parent
bbf2ee6ad4
commit
89b54ecd8b
@@ -183,7 +183,7 @@ static inline void __init *determine_relocation_address(void)
|
||||
if (kaslr_disabled())
|
||||
return destination;
|
||||
|
||||
kernel_length = (long)_end - (long)_text;
|
||||
kernel_length = (unsigned long)_end - (unsigned long)_text;
|
||||
|
||||
random_offset = get_random_boot() << 16;
|
||||
random_offset &= (CONFIG_RANDOMIZE_BASE_MAX_OFFSET - 1);
|
||||
@@ -232,7 +232,7 @@ unsigned long __init relocate_kernel(void)
|
||||
early_memunmap(cmdline, COMMAND_LINE_SIZE);
|
||||
|
||||
if (random_offset) {
|
||||
kernel_length = (long)(_end) - (long)(_text);
|
||||
kernel_length = (unsigned long)(_end) - (unsigned long)(_text);
|
||||
|
||||
/* Copy the kernel to it's new location */
|
||||
memcpy(location_new, _text, kernel_length);
|
||||
|
||||
Reference in New Issue
Block a user