Skip to content

Commit a258a3c

Browse files
seehearfeelchenhuacai
authored andcommitted
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: e5f02b5 ("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>
1 parent 4a71df1 commit a258a3c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

arch/loongarch/kernel/relocate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static inline void __init *determine_relocation_address(void)
183183
if (kaslr_disabled())
184184
return destination;
185185

186-
kernel_length = (long)_end - (long)_text;
186+
kernel_length = (unsigned long)_end - (unsigned long)_text;
187187

188188
random_offset = get_random_boot() << 16;
189189
random_offset &= (CONFIG_RANDOMIZE_BASE_MAX_OFFSET - 1);
@@ -232,7 +232,7 @@ unsigned long __init relocate_kernel(void)
232232
early_memunmap(cmdline, COMMAND_LINE_SIZE);
233233

234234
if (random_offset) {
235-
kernel_length = (long)(_end) - (long)(_text);
235+
kernel_length = (unsigned long)(_end) - (unsigned long)(_text);
236236

237237
/* Copy the kernel to it's new location */
238238
memcpy(location_new, _text, kernel_length);

0 commit comments

Comments
 (0)