]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
riscv: ftrace: Add parentheses in macro definitions of make_call_t0 and make_call_ra
authorJuhan Jin <juhan.jin@foxmail.com>
Thu, 6 Feb 2025 19:28:36 +0000 (13:28 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:33:40 +0000 (14:33 +0200)
commitfb5069d017b5bc63940b0916d985bd4df0d12eb1
treee7dfe46672032180e01d045e611f46a6b9b993f8
parenta333f223e555d27609f8b45d75a08e8e1d36c432
riscv: ftrace: Add parentheses in macro definitions of make_call_t0 and make_call_ra

[ Upstream commit 5f1a58ed91a040d4625d854f9bb3dd4995919202 ]

This patch adds parentheses to parameters caller and callee of macros
make_call_t0 and make_call_ra. Every existing invocation of these two
macros uses a single variable for each argument, so the absence of the
parentheses seems okay. However, future invocations might use more
complex expressions as arguments. For example, a future invocation might
look like this: make_call_t0(a - b, c, call). Without parentheses in the
macro definition, the macro invocation expands to:

...
unsigned int offset = (unsigned long) c - (unsigned long) a - b;
...

which is clearly wrong.

The use of parentheses ensures arguments are correctly evaluated and
potentially saves future users of make_call_t0 and make_call_ra debugging
trouble.

Fixes: 6724a76cff85 ("riscv: ftrace: Reduce the detour code size to half")
Signed-off-by: Juhan Jin <juhan.jin@foxmail.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/tencent_AE90AA59903A628E87E9F80E563DA5BA5508@qq.com
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/riscv/include/asm/ftrace.h