[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176173057191.2601451.17429694962908519380.tip-bot2@tip-bot2>
Date: Wed, 29 Oct 2025 09:36:11 -0000
From: "tip-bot2 for Peter Zijlstra" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: "Peter Zijlstra (Intel)" <peterz@...radead.org>,
 "Steven Rostedt (Google)" <rostedt@...dmis.org>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Subject:
 [tip: perf/core] unwind: Simplify unwind_user_next_fp() alignment check
The following commit has been merged into the perf/core branch of tip:
Commit-ID:     5578534e4b92350995a20068f2e6ea3186c62d7f
Gitweb:        https://git.kernel.org/tip/5578534e4b92350995a20068f2e6ea3186c62d7f
Author:        Peter Zijlstra <peterz@...radead.org>
AuthorDate:    Tue, 23 Sep 2025 13:04:09 +02:00
Committer:     Peter Zijlstra <peterz@...radead.org>
CommitterDate: Wed, 29 Oct 2025 10:29:57 +01:00
unwind: Simplify unwind_user_next_fp() alignment check
  2^log_2(n) == n
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@...dmis.org>
Link: https://patch.msgid.link/20250924080119.497867836@infradead.org
---
 kernel/unwind/user.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c
index 97a8415..9dcde79 100644
--- a/kernel/unwind/user.c
+++ b/kernel/unwind/user.c
@@ -19,7 +19,6 @@ static int unwind_user_next_fp(struct unwind_user_state *state)
 {
 	const struct unwind_user_frame *frame = &fp_frame;
 	unsigned long cfa, fp, ra;
-	unsigned int shift;
 
 	if (frame->use_fp) {
 		if (state->fp < state->sp)
@@ -37,8 +36,7 @@ static int unwind_user_next_fp(struct unwind_user_state *state)
 		return -EINVAL;
 
 	/* Make sure that the address is word aligned */
-	shift = sizeof(long) == 4 ? 2 : 3;
-	if (cfa & ((1 << shift) - 1))
+	if (cfa & (sizeof(long) - 1))
 		return -EINVAL;
 
 	/* Find the Return Address (RA) */
Powered by blists - more mailing lists
 
