Skip to content

Commit 50def26

Browse files
nivedita76ingomolnar
authored andcommitted
x86/kaslr: Short-circuit gb_huge_pages on x86-32
32-bit does not have GB pages, so don't bother checking for them. Using the IS_ENABLED() macro allows the compiler to completely remove the gb_huge_pages code. 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-12-nivedita@alum.mit.edu
1 parent 79c2fd2 commit 50def26

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

arch/x86/boot/compressed/kaslr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static void handle_mem_options(void)
303303

304304
if (!strcmp(param, "memmap")) {
305305
mem_avoid_memmap(PARSE_MEMMAP, val);
306-
} else if (strstr(param, "hugepages")) {
306+
} else if (IS_ENABLED(CONFIG_X86_64) && strstr(param, "hugepages")) {
307307
parse_gb_huge_pages(param, val);
308308
} else if (!strcmp(param, "mem")) {
309309
char *p = val;
@@ -551,7 +551,7 @@ process_gb_huge_pages(struct mem_vector *region, unsigned long image_size)
551551
struct mem_vector tmp;
552552
int i = 0;
553553

554-
if (!max_gb_huge_pages) {
554+
if (!IS_ENABLED(CONFIG_X86_64) || !max_gb_huge_pages) {
555555
store_slot_info(region, image_size);
556556
return;
557557
}

0 commit comments

Comments
 (0)