diff options
author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2021-05-18 12:40:21 +0100 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2021-06-07 12:56:18 +0100 |
commit | 4f706b078fd50a8eed9543a8d3fc64f1e840b7d2 (patch) | |
tree | 912979c534bf3f01e616de5649c691024f2c8391 | |
parent | 01bb34852bf3b3e25455340fa3fedf9fc4ba38d6 (diff) |
ARM: use a temporary variable to hold maximum vmalloc size
We calculate the maximum size of the vmalloc space twice in
early_vmalloc(). Use a temporary variable to hold this value.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Yanfei Xu <yanfei.xu@windriver.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | arch/arm/mm/mmu.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index ec57d4a44b89..532b489a306c 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1132,6 +1132,7 @@ static unsigned long __initdata vmalloc_min = static int __init early_vmalloc(char *arg) { unsigned long vmalloc_reserve = memparse(arg, NULL); + unsigned long vmalloc_max; if (vmalloc_reserve < SZ_16M) { vmalloc_reserve = SZ_16M; @@ -1139,8 +1140,9 @@ static int __init early_vmalloc(char *arg) vmalloc_reserve >> 20); } - if (vmalloc_reserve > VMALLOC_END - (PAGE_OFFSET + SZ_32M)) { - vmalloc_reserve = VMALLOC_END - (PAGE_OFFSET + SZ_32M); + vmalloc_max = VMALLOC_END - (PAGE_OFFSET + SZ_32M); + if (vmalloc_reserve > vmalloc_max) { + vmalloc_reserve = vmalloc_max; pr_warn("vmalloc area is too big, limiting to %luMB\n", vmalloc_reserve >> 20); } |