]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
um: Use PAGE_ALIGN() for address alignment
authorTiwei Bie <tiwei.btw@antgroup.com>
Mon, 27 Oct 2025 05:45:17 +0000 (13:45 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 27 Oct 2025 15:37:12 +0000 (16:37 +0100)
Use PAGE_ALIGN() instead of open-coded calculations.

Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
Link: https://patch.msgid.link/20251027054519.1996090-3-tiwei.bie@linux.dev
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
arch/um/kernel/um_arch.c

index 4b14f1ea2690112bef80ad92d4b6e8bb26088139..fcabef8c72245679485000cb21f3bc178c1365c5 100644 (file)
@@ -294,10 +294,7 @@ static unsigned long __init get_top_address(char **envp)
                        top_addr = (unsigned long) envp[i];
        }
 
-       top_addr &= ~(UM_KERN_PAGE_SIZE - 1);
-       top_addr += UM_KERN_PAGE_SIZE;
-
-       return top_addr;
+       return PAGE_ALIGN(top_addr + 1);
 }
 
 int __init linux_main(int argc, char **argv, char **envp)
@@ -366,8 +363,8 @@ int __init linux_main(int argc, char **argv, char **envp)
 
        setup_machinename(init_utsname()->machine);
 
-       physmem_size = (physmem_size + PAGE_SIZE - 1) & PAGE_MASK;
-       iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK;
+       physmem_size = PAGE_ALIGN(physmem_size);
+       iomem_size = PAGE_ALIGN(iomem_size);
 
        max_physmem = TASK_SIZE - uml_physmem - iomem_size - MIN_VMALLOC;
        if (physmem_size > max_physmem) {