diff options
author | Arvind Sankar <nivedita@alum.mit.edu> | 2020-07-29 01:57:14 +0300 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2020-07-31 12:08:17 +0300 |
commit | 3870d971791f13df88a7a656e3fd6e2df8686097 (patch) | |
tree | 6140d277cf8df222d2f45f41bceb957e0ac797e9 /arch/x86/boot | |
parent | be9e8d9541a95bdfac1c13d112cc032ea7fc745f (diff) | |
download | linux-3870d971791f13df88a7a656e3fd6e2df8686097.tar.xz |
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
Diffstat (limited to 'arch/x86/boot')
-rw-r--r-- | arch/x86/boot/compressed/kaslr.c | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index 00ef84b689f6..bd13dc5e64b7 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot/compressed/kaslr.c @@ -279,10 +279,6 @@ static void handle_mem_options(void) if (!args) return; - if (!strstr(args, "memmap=") && !strstr(args, "mem=") && - !strstr(args, "hugepages")) - return; - len = strlen(args); tmp_cmdline = malloc(len + 1); if (!tmp_cmdline) |