]> git.ipfire.org Git - thirdparty/linux.git/commit
riscv: tracing: Fix __write_overflow_field in ftrace_partial_regs()
authorCharlie Jenkins <charlie@rivosinc.com>
Tue, 25 Feb 2025 02:42:21 +0000 (18:42 -0800)
committerAlexandre Ghiti <alexghiti@rivosinc.com>
Tue, 18 Mar 2025 13:06:05 +0000 (13:06 +0000)
commitbba547810c66434475d8800b3411c59ef71eafe9
tree875d248daa3066705644051b4b4fd5eb2c2c95dc
parent72770690e02c082efbbbd78d768028cf8dd18b9c
riscv: tracing: Fix __write_overflow_field in ftrace_partial_regs()

The size of &regs->a0 is unknown, causing the error:

../include/linux/fortify-string.h:571:25: warning: call to
'__write_overflow_field' declared with attribute warning: detected write
beyond size of field (1st parameter); maybe use struct_group()?
[-Wattribute-warning]

Fix this by wrapping the required registers in pt_regs with
struct_group() and reference the group when doing the offending
memcpy().

Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Tested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Link: https://lore.kernel.org/r/20250224-fix_ftrace_partial_regs-v1-1-54b906417e86@rivosinc.com
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
arch/riscv/include/asm/ftrace.h
arch/riscv/include/asm/ptrace.h