diff mbox series

[3/3] mm: kmsan: use helper macros PAGE_ALIGN and PAGE_ALIGN_DOWN

Message ID 20230727011612.2721843-4-zhangpeng362@huawei.com (mailing list archive)
State New
Headers show
Series minor cleanups for kmsan | expand

Commit Message

Peng Zhang July 27, 2023, 1:16 a.m. UTC
From: ZhangPeng <zhangpeng362@huawei.com>

Use helper macros PAGE_ALIGN and PAGE_ALIGN_DOWN to improve code
readability. No functional modification involved.

Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
---
 mm/kmsan/shadow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Alexander Potapenko July 31, 2023, 5:02 p.m. UTC | #1
On Thu, Jul 27, 2023 at 3:16 AM 'Peng Zhang' via kasan-dev
<kasan-dev@googlegroups.com> wrote:
>
> From: ZhangPeng <zhangpeng362@huawei.com>
>
> Use helper macros PAGE_ALIGN and PAGE_ALIGN_DOWN to improve code
> readability. No functional modification involved.
>
> Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
Reviewed-by: Alexander Potapenko <glider@google.com>
Alexander Potapenko July 31, 2023, 5:02 p.m. UTC | #2
On Mon, Jul 31, 2023 at 7:02 PM Alexander Potapenko <glider@google.com> wrote:
>
> On Thu, Jul 27, 2023 at 3:16 AM 'Peng Zhang' via kasan-dev
> <kasan-dev@googlegroups.com> wrote:
> >
> > From: ZhangPeng <zhangpeng362@huawei.com>
> >
> > Use helper macros PAGE_ALIGN and PAGE_ALIGN_DOWN to improve code
> > readability. No functional modification involved.
> >
> > Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
> Reviewed-by: Alexander Potapenko <glider@google.com>

Thanks for the series!
diff mbox series

Patch

diff --git a/mm/kmsan/shadow.c b/mm/kmsan/shadow.c
index 966994268a01..87318f9170f1 100644
--- a/mm/kmsan/shadow.c
+++ b/mm/kmsan/shadow.c
@@ -281,8 +281,8 @@  void __init kmsan_init_alloc_meta_for_range(void *start, void *end)
 	struct page *page;
 	u64 size;
 
-	start = (void *)ALIGN_DOWN((u64)start, PAGE_SIZE);
-	size = ALIGN((u64)end - (u64)start, PAGE_SIZE);
+	start = (void *)PAGE_ALIGN_DOWN((u64)start);
+	size = PAGE_ALIGN((u64)end - (u64)start);
 	shadow = memblock_alloc(size, PAGE_SIZE);
 	origin = memblock_alloc(size, PAGE_SIZE);
 	for (u64 addr = 0; addr < size; addr += PAGE_SIZE) {