aboutsummaryrefslogtreecommitdiff
path: root/arch/mips/kernel/relocate.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/relocate.c')
-rw-r--r--arch/mips/kernel/relocate.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/mips/kernel/relocate.c b/arch/mips/kernel/relocate.c
index c643c816cbe0..95abb9c82f00 100644
--- a/arch/mips/kernel/relocate.c
+++ b/arch/mips/kernel/relocate.c
@@ -300,6 +300,13 @@ static inline int __init relocation_addr_valid(void *loc_new)
return 1;
}
+static inline void __init update_kaslr_offset(unsigned long *addr, long offset)
+{
+ unsigned long *new_addr = (unsigned long *)RELOCATED(addr);
+
+ *new_addr = (unsigned long)offset;
+}
+
#if defined(CONFIG_USE_OF)
void __weak *plat_get_fdt(void)
{
@@ -410,6 +417,9 @@ void *__init relocate_kernel(void)
/* Return the new kernel's entry point */
kernel_entry = RELOCATED(start_kernel);
+
+ /* Error may occur before, so keep it at last */
+ update_kaslr_offset(&__kaslr_offset, offset);
}
out:
return kernel_entry;