bpf, x86: initialize the variable "first_off" in save_args()
Subsystems (5)
PATCH 1/1 bpf, x86: initialize the variable "first_off" in save_args()
From: Menglong Dong <[email protected]>
As Dan Carpenter reported, the variable "first_off" which is passed to clean_stack_garbage() in save_args() can be uninitialized, which can cause runtime warnings with KMEMsan. Therefore, init it with 0.
--- arch/x86/net/bpf_jit_comp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/net/bpf_jit_comp.c +1 -1
@@ -1925,7 +1925,7 @@ static int get_nr_used_regs(const struct btf_func_model *m)static void save_args (const struct btf_func_model *m,u8 **prog,int stack_size,bool for_call_origin) { -int arg_regs, first_off, nr_regs =0 , nr_stack_slots =0 ; +int arg_regs, first_off =0 , nr_regs =0 , nr_stack_slots =0 ;int i, j;/* Store function arguments to stack.
Signature · 1 line
2.40.1
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 6 lines · On Wed, 19 Jul 2023 19:03:30 +0800 you wrote:
From: Menglong Dong <[email protected]>
As Dan Carpenter reported, the variable "
first_off" which is passed toclean_stack_garbage()insave_args()can be uninitialized, which can cause runtime warnings with KMEMsan. Therefore, init it with 0.
Quoted 7 lines
Fixes 473e3150e30a ("bpf, x86: allow function arguments up to 12 for TRACING")Cc Hao Peng <[email protected]>Reported-by Dan Carpenter <[email protected]>Signed-off-by Menglong Dong <[email protected]>[...]
Here is the summary with links:
- [bpf-next] bpf, x86: initialize the variable "first_off" in save_args()
https://git.kernel.org/bpf/bpf-next/c/492e797fdab2
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html