diff options
| author | Peter Zijlstra <peterz@infradead.org> | 2025-09-23 13:04:09 +0200 |
|---|---|---|
| committer | Sasha Levin <sashal@kernel.org> | 2026-03-12 07:09:27 -0400 |
| commit | 5364f7bbd611a87cd123673e2549ab3e2e4a91ea (patch) | |
| tree | 700dd051dfaa0318a9149d8670ec07f8b033f43d | |
| parent | c45026c4135d4b336bd6a591b152a4c1570656be (diff) | |
unwind: Simplify unwind_user_next_fp() alignment check
[ Upstream commit 5578534e4b92350995a20068f2e6ea3186c62d7f ]
2^log_2(n) == n
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Link: https://patch.msgid.link/20250924080119.497867836@infradead.org
Stable-dep-of: d55c571e4333 ("x86/uprobes: Fix XOL allocation failure for 32-bit tasks")
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | kernel/unwind/user.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/kernel/unwind/user.c b/kernel/unwind/user.c index 97a8415e3216..9dcde797b5d9 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) */ |
