Skip to content

Commit 1ef64b1

Browse files
rddunlapsuryasaimadhu
authored andcommitted
x86/mm: Cleanup the control_va_addr_alignment() __setup handler
Clean up control_va_addr_alignment(): a. Make '=' required instead of optional (as documented). b. Print a warning if an invalid option value is used. c. Return 1 from the __setup handler when an invalid option value is used. This prevents the kernel from polluting init's (limited) environment space with the entire string. Fixes: dfb09f9 ("x86, amd: Avoid cache aliasing penalties on AMD family 15h") Reported-by: Igor Zhbanov <[email protected]> Signed-off-by: Randy Dunlap <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 12441cc commit 1ef64b1

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

arch/x86/kernel/sys_x86_64.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ static int __init control_va_addr_alignment(char *str)
6868
if (*str == 0)
6969
return 1;
7070

71-
if (*str == '=')
72-
str++;
73-
7471
if (!strcmp(str, "32"))
7572
va_align.flags = ALIGN_VA_32;
7673
else if (!strcmp(str, "64"))
@@ -80,11 +77,11 @@ static int __init control_va_addr_alignment(char *str)
8077
else if (!strcmp(str, "on"))
8178
va_align.flags = ALIGN_VA_32 | ALIGN_VA_64;
8279
else
83-
return 0;
80+
pr_warn("invalid option value: 'align_va_addr=%s'\n", str);
8481

8582
return 1;
8683
}
87-
__setup("align_va_addr", control_va_addr_alignment);
84+
__setup("align_va_addr=", control_va_addr_alignment);
8885

8986
SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
9087
unsigned long, prot, unsigned long, flags,

0 commit comments

Comments
 (0)