diff options
| author | Tiwei Bie <tiwei.btw@antgroup.com> | 2025-10-27 13:45:17 +0800 |
|---|---|---|
| committer | Johannes Berg <johannes.berg@intel.com> | 2025-10-27 16:37:12 +0100 |
| commit | de203267483de10bdfc3ec74fac246e879361819 (patch) | |
| tree | eed9e8e25ee4c3df49a2ccdf703b359efb8d6c97 /arch/um/kernel/um_arch.c | |
| parent | 691ff5914835a65151f3793e8b4dea0b230d0b6b (diff) | |
um: Use PAGE_ALIGN() for address alignment
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>
Diffstat (limited to 'arch/um/kernel/um_arch.c')
| -rw-r--r-- | arch/um/kernel/um_arch.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c index 4b14f1ea2690..fcabef8c7224 100644 --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -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) { |