Skip to content

Commit

Permalink
initrd: Fix virtual/physical mix-up in overwrite test
Browse files Browse the repository at this point in the history
On recent kernels, I get the following error when using an initrd:

| initrd overwritten (0x00b78000 < 0x07668000) - disabling it.

My Amiga 4000 has 12 MiB of RAM at physical address 0x07400000 (virtual
0x00000000).
The initrd is located at the end of RAM: 0x00b78000 - 0x00c00000 (virtual).
The overwrite test compares the (virtual) initrd location to the (physical)
first available memory location, which fails.

This patch converts initrd_start to a page frame number, so it can safely be
compared with min_low_pfn.

Before the introduction of discontiguous memory support on m68k
(12d810c), min_low_pfn was just left
untouched by the m68k-specific code (zero, I guess), and everything worked
fine.

Signed-off-by: Geert Uytterhoeven <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
geertu authored and torvalds committed Jul 21, 2008
1 parent 18c9936 commit fb6624e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,10 @@ asmlinkage void __init start_kernel(void)

#ifdef CONFIG_BLK_DEV_INITRD
if (initrd_start && !initrd_below_start_ok &&
initrd_start < min_low_pfn << PAGE_SHIFT) {
page_to_pfn(virt_to_page(initrd_start)) < min_low_pfn) {
printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - "
"disabling it.\n",initrd_start,min_low_pfn << PAGE_SHIFT);
"disabling it.\n",
page_to_pfn(virt_to_page(initrd_start)), min_low_pfn);
initrd_start = 0;
}
#endif
Expand Down

0 comments on commit fb6624e

Please sign in to comment.