Skip to contentSkip to conversation

repair bootmem memory leak

PATCH New William Lee Irwin III 1 participant 1 message Nov 5, 2001

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 repair bootmem memory leak

While developing my fresh bootmem, the testing I did to ensure there were no memory leaks discovered a caller leaking memory:

arch/i386/kernel/setup.c +1 -1
diff -urN linux-virgin/arch/i386/kernel/setup.c linux/arch/i386/kernel/setup.c
@@ -926,7 +926,7 @@
 	 * bootmem allocator with an invalid RAM area.
 	 */
 	reserve_bootmem(HIGH_MEMORY, (PFN_PHYS(start_pfn) +
-			 bootmap_size + PAGE_SIZE-1) - (HIGH_MEMORY));
+			 		bootmap_size) - (HIGH_MEMORY));
 
 	/*
 	 * reserve physical page 0 - it's a special BIOS page on many boxes,

reserve_boootmem_core() already ensures that the endpoint of the interval to reserve is rounded up to a page boundary, and so this (demonstrably) leaks a page whenever
PFN_PHYS(start_pfn) + bootmap_size + PAGE_SIZE -1
is not page-aligned.

Cheers,
Bill
-----------------
[email protected]