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

mm/rodata_test: use PAGE_ALIGNED() helper

Use PAGE_ALIGNED() helper instead of open-coding operation, no functional
changes here.

Link: https://lkml.kernel.org/r/20220906075312.166595-1-xiujianfeng@huawei.com
Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Xiu Jianfeng and committed by
Andrew Morton
679d7f69 4e07acdd

+3 -5
+3 -5
mm/rodata_test.c
··· 9 9 10 10 #include <linux/rodata_test.h> 11 11 #include <linux/uaccess.h> 12 + #include <linux/mm.h> 12 13 #include <asm/sections.h> 13 14 14 15 static const int rodata_test_data = 0xC3; 15 16 16 17 void rodata_test(void) 17 18 { 18 - unsigned long start, end; 19 19 int zero = 0; 20 20 21 21 /* test 1: read the value */ ··· 39 39 } 40 40 41 41 /* test 4: check if the rodata section is PAGE_SIZE aligned */ 42 - start = (unsigned long)__start_rodata; 43 - end = (unsigned long)__end_rodata; 44 - if (start & (PAGE_SIZE - 1)) { 42 + if (!PAGE_ALIGNED(__start_rodata)) { 45 43 pr_err("start of .rodata is not page size aligned\n"); 46 44 return; 47 45 } 48 - if (end & (PAGE_SIZE - 1)) { 46 + if (!PAGE_ALIGNED(__end_rodata)) { 49 47 pr_err("end of .rodata is not page size aligned\n"); 50 48 return; 51 49 }