Skip to content

Commit 3870d97

Browse files
nivedita76ingomolnar
authored andcommitted
x86/kaslr: Drop test for command-line parameters before parsing
This check doesn't save anything. In the case when none of the parameters are present, each strstr will scan args twice (once to find the length and then for searching), six scans in total. Just going ahead and parsing the arguments only requires three scans: strlen, memcpy, and parsing. This will be the first malloc, so free will actually free up the memory, so the check doesn't save heap space either. 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-14-nivedita@alum.mit.edu
1 parent be9e8d9 commit 3870d97

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

arch/x86/boot/compressed/kaslr.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,6 @@ static void handle_mem_options(void)
279279
if (!args)
280280
return;
281281

282-
if (!strstr(args, "memmap=") && !strstr(args, "mem=") &&
283-
!strstr(args, "hugepages"))
284-
return;
285-
286282
len = strlen(args);
287283
tmp_cmdline = malloc(len + 1);
288284
if (!tmp_cmdline)

0 commit comments

Comments
 (0)