Commit 679d7f69 authored by Xiu Jianfeng's avatar Xiu Jianfeng Committed by Andrew Morton

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.comSigned-off-by: default avatarXiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 4e07acdd
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
#include <linux/rodata_test.h> #include <linux/rodata_test.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/mm.h>
#include <asm/sections.h> #include <asm/sections.h>
static const int rodata_test_data = 0xC3; static const int rodata_test_data = 0xC3;
void rodata_test(void) void rodata_test(void)
{ {
unsigned long start, end;
int zero = 0; int zero = 0;
/* test 1: read the value */ /* test 1: read the value */
...@@ -39,13 +39,11 @@ void rodata_test(void) ...@@ -39,13 +39,11 @@ void rodata_test(void)
} }
/* test 4: check if the rodata section is PAGE_SIZE aligned */ /* test 4: check if the rodata section is PAGE_SIZE aligned */
start = (unsigned long)__start_rodata; if (!PAGE_ALIGNED(__start_rodata)) {
end = (unsigned long)__end_rodata;
if (start & (PAGE_SIZE - 1)) {
pr_err("start of .rodata is not page size aligned\n"); pr_err("start of .rodata is not page size aligned\n");
return; return;
} }
if (end & (PAGE_SIZE - 1)) { if (!PAGE_ALIGNED(__end_rodata)) {
pr_err("end of .rodata is not page size aligned\n"); pr_err("end of .rodata is not page size aligned\n");
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment