Skip to content

Commit 4897a89

Browse files
dliviutsbogend
authored andcommitted
mips: Move initrd_start check after initrd address sanitisation.
PAGE_OFFSET is technically a virtual address so when checking the value of initrd_start against it we should make sure that it has been sanitised from the values passed by the bootloader. Without this change, even with a bootloader that passes correct addresses for an initrd, we are failing to load it on MT7621 boards, for example. Signed-off-by: Liviu Dudau <liviu@dudau.co.uk> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
1 parent 2d64560 commit 4897a89

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

arch/mips/kernel/setup.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ static unsigned long __init init_initrd(void)
158158
pr_err("initrd start must be page aligned\n");
159159
goto disable;
160160
}
161-
if (initrd_start < PAGE_OFFSET) {
162-
pr_err("initrd start < PAGE_OFFSET\n");
163-
goto disable;
164-
}
165161

166162
/*
167163
* Sanitize initrd addresses. For example firmware
@@ -174,6 +170,11 @@ static unsigned long __init init_initrd(void)
174170
initrd_end = (unsigned long)__va(end);
175171
initrd_start = (unsigned long)__va(__pa(initrd_start));
176172

173+
if (initrd_start < PAGE_OFFSET) {
174+
pr_err("initrd start < PAGE_OFFSET\n");
175+
goto disable;
176+
}
177+
177178
ROOT_DEV = Root_RAM0;
178179
return PFN_UP(end);
179180
disable:

0 commit comments

Comments
 (0)