From: Kirill A. Shutemov Date: Wed, 15 Mar 2023 11:31:25 +0000 (+0300) Subject: um: fix MAX_ORDER usage in linux_main() X-Git-Tag: v6.6.7~2970^2~270 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=254ca6d261d4b6ce00591de110f6f96c3556dfbe;p=platform%2Fkernel%2Flinux-starfive.git um: fix MAX_ORDER usage in linux_main() MAX_ORDER is not inclusive: the maximum allocation order buddy allocator can deliver is MAX_ORDER-1. Fix MAX_ORDER usage in linux_main(). Link: https://lkml.kernel.org/r/20230315113133.11326-3-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov Acked-by: Mike Rapoport (IBM) Cc: Richard Weinberger Cc: Anton Ivanov Cc: Johannes Berg Signed-off-by: Andrew Morton --- diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 8dcda61..5e5a9c8 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -368,10 +368,10 @@ int __init linux_main(int argc, char **argv) max_physmem = TASK_SIZE - uml_physmem - iomem_size - MIN_VMALLOC; /* - * Zones have to begin on a 1 << MAX_ORDER page boundary, + * Zones have to begin on a 1 << MAX_ORDER-1 page boundary, * so this makes sure that's true for highmem */ - max_physmem &= ~((1 << (PAGE_SHIFT + MAX_ORDER)) - 1); + max_physmem &= ~((1 << (PAGE_SHIFT + MAX_ORDER - 1)) - 1); if (physmem_size + iomem_size > max_physmem) { highmem = physmem_size + iomem_size - max_physmem; physmem_size -= highmem;