Skip to content

Commit

Permalink
MIPS: init: Ensure reserved memory regions are not added to bootmem
Browse files Browse the repository at this point in the history
Memories managed through boot_mem_map are generally expected to define
non-crossing areas. However, if part of a larger memory block is marked
as reserved, it would still be added to bootmem allocator as an
available block and could end up being overwritten by the allocator.

Prevent this by explicitly marking the memory as reserved it if exists
in the range used by bootmem allocator.

Signed-off-by: Marcin Nowakowski <[email protected]>
Cc: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/14608/
Signed-off-by: Ralf Baechle <[email protected]>
  • Loading branch information
MJNowakowski authored and ralfbaechle committed Jan 3, 2017
1 parent 269aa43 commit e89ef66
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions arch/mips/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,10 @@ static void __init bootmem_init(void)
continue;
default:
/* Not usable memory */
if (start > min_low_pfn && end < max_low_pfn)
reserve_bootmem(boot_mem_map.map[i].addr,
boot_mem_map.map[i].size,
BOOTMEM_DEFAULT);
continue;
}

Expand Down

0 comments on commit e89ef66

Please sign in to comment.