Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Tiwei Bie and committed by
Johannes Berg
de203267 691ff591

+3 -6
+3 -6
arch/um/kernel/um_arch.c
··· 294 294 top_addr = (unsigned long) envp[i]; 295 295 } 296 296 297 - top_addr &= ~(UM_KERN_PAGE_SIZE - 1); 298 - top_addr += UM_KERN_PAGE_SIZE; 299 - 300 - return top_addr; 297 + return PAGE_ALIGN(top_addr + 1); 301 298 } 302 299 303 300 int __init linux_main(int argc, char **argv, char **envp) ··· 363 366 364 367 setup_machinename(init_utsname()->machine); 365 368 366 - physmem_size = (physmem_size + PAGE_SIZE - 1) & PAGE_MASK; 367 - iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK; 369 + physmem_size = PAGE_ALIGN(physmem_size); 370 + iomem_size = PAGE_ALIGN(iomem_size); 368 371 369 372 max_physmem = TASK_SIZE - uml_physmem - iomem_size - MIN_VMALLOC; 370 373 if (physmem_size > max_physmem) {