mm/rodata_test: use PAGE_ALIGNED() helper
authorXiu Jianfeng <xiujianfeng@huawei.com>
Tue, 6 Sep 2022 07:53:12 +0000 (15:53 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 3 Oct 2022 21:03:05 +0000 (14:03 -0700)
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>
mm/rodata_test.c

index 2613371945b7ec6f8f1ce24ad378ba539f4d9bc0..6d783436951f324f769c28ad6091c9a62bf85690 100644 (file)
@@ -9,13 +9,13 @@
 
 #include <linux/rodata_test.h>
 #include <linux/uaccess.h>
+#include <linux/mm.h>
 #include <asm/sections.h>
 
 static const int rodata_test_data = 0xC3;
 
 void rodata_test(void)
 {
-       unsigned long start, end;
        int zero = 0;
 
        /* test 1: read the value */
@@ -39,13 +39,11 @@ void rodata_test(void)
        }
 
        /* test 4: check if the rodata section is PAGE_SIZE aligned */
-       start = (unsigned long)__start_rodata;
-       end = (unsigned long)__end_rodata;
-       if (start & (PAGE_SIZE - 1)) {
+       if (!PAGE_ALIGNED(__start_rodata)) {
                pr_err("start of .rodata is not page size aligned\n");
                return;
        }
-       if (end & (PAGE_SIZE - 1)) {
+       if (!PAGE_ALIGNED(__end_rodata)) {
                pr_err("end of .rodata is not page size aligned\n");
                return;
        }