mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 23:52:08 +02: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: e5f02b51fa ("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>
This commit is contained in:
parent
4a71df151e
commit
a258a3cb18
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user