From: Igor Putko <igorpetindev@gmail.com>
To: ryabinin.a.a@gmail.com, glider@google.com, andreyknvl@gmail.com,
dvyukov@google.com, vincenzo.frascino@arm.com,
akpm@linux-foundation.org
Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, Igor Putko <igorpetindev@gmail.com>
Subject: [PATCH 2/3] kasan: common: use ALIGN_DOWN macro for stack alignment
Date: Sat, 4 Jul 2026 12:20:06 +0300 [thread overview]
Message-ID: <20260704092007.3483-3-igorpetindev@gmail.com> (raw)
In-Reply-To: <20260704092007.3483-1-igorpetindev@gmail.com>
Replace the manual bitwise alignment logic in
kasan_unpoison_task_stack_below() with the
standard ALIGN_DOWN macro. This improves code
readability and conforms to standard kernel idioms.
Signed-off-by: Igor Putko <igorpetindev@gmail.com>
---
mm/kasan/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/kasan/common.c b/mm/kasan/common.c
index 34aa0fdce..5faf73c8f 100644
--- a/mm/kasan/common.c
+++ b/mm/kasan/common.c
@@ -119,7 +119,7 @@ asmlinkage void kasan_unpoison_task_stack_below(const void *watermark)
* because this function is called by early resume code which hasn't
* yet set up the percpu register (%gs).
*/
- void *base = (void *)((unsigned long)watermark & ~(THREAD_SIZE - 1));
+ void *base = (void *)ALIGN_DOWN((unsigned long)watermark, THREAD_SIZE);
kasan_unpoison(base, watermark - base, false);
}
--
2.47.3
next prev parent reply other threads:[~2026-07-04 9:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-04 9:20 [PATCH 0/3] kasan: common: cleanups and deduplication Igor Putko
2026-07-04 9:20 ` [PATCH 1/3] kasan: deduplicate quarantine reduction logic Igor Putko
2026-07-04 9:20 ` Igor Putko [this message]
2026-07-04 9:20 ` [PATCH 3/3] kasan: common: replace magic number with KASAN_TAG_KERNEL Igor Putko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260704092007.3483-3-igorpetindev@gmail.com \
--to=igorpetindev@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ryabinin.a.a@gmail.com \
--cc=vincenzo.frascino@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox