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

Peng Zhang posted 3 patches 2 years, 6 months ago
[PATCH 3/3] mm: kmsan: use helper macros PAGE_ALIGN and PAGE_ALIGN_DOWN
Posted by Peng Zhang 2 years, 6 months ago
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(-)

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) {
-- 
2.25.1
Re: [PATCH 3/3] mm: kmsan: use helper macros PAGE_ALIGN and PAGE_ALIGN_DOWN
Posted by Alexander Potapenko 2 years, 6 months ago
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>
Re: [PATCH 3/3] mm: kmsan: use helper macros PAGE_ALIGN and PAGE_ALIGN_DOWN
Posted by Alexander Potapenko 2 years, 6 months ago
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!