Skip to content

Commit 79c2fd2

Browse files
nivedita76ingomolnar
authored andcommitted
x86/kaslr: Fix off-by-one error in process_gb_huge_pages()
If the remaining size of the region is exactly 1Gb, there is still one hugepage that can be reserved. Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20200728225722.67457-11-nivedita@alum.mit.edu
1 parent bf457be commit 79c2fd2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

arch/x86/boot/compressed/kaslr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ process_gb_huge_pages(struct mem_vector *region, unsigned long image_size)
562562
size = region->size - (addr - region->start);
563563

564564
/* Check how many 1GB huge pages can be filtered out: */
565-
while (size > PUD_SIZE && max_gb_huge_pages) {
565+
while (size >= PUD_SIZE && max_gb_huge_pages) {
566566
size -= PUD_SIZE;
567567
max_gb_huge_pages--;
568568
i++;

0 commit comments

Comments
 (0)