[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230719110330.2007949-1-imagedong@tencent.com>
Date: Wed, 19 Jul 2023 19:03:30 +0800
From: menglong8.dong@...il.com
To: yhs@...com
Cc: davem@...emloft.net,
dsahern@...nel.org,
ast@...nel.org,
daniel@...earbox.net,
andrii@...nel.org,
martin.lau@...ux.dev,
song@...nel.org,
john.fastabend@...il.com,
kpsingh@...nel.org,
sdf@...gle.com,
haoluo@...gle.com,
jolsa@...nel.org,
tglx@...utronix.de,
mingo@...hat.com,
bp@...en8.de,
dave.hansen@...ux.intel.com,
x86@...nel.org,
hpa@...or.com,
imagedong@...cent.com,
netdev@...r.kernel.org,
bpf@...r.kernel.org,
linux-kernel@...r.kernel.org,
Hao Peng <flyingpeng@...cent.com>,
Dan Carpenter <dan.carpenter@...aro.org>
Subject: [PATCH bpf-next] bpf, x86: initialize the variable "first_off" in save_args()
From: Menglong Dong <imagedong@...cent.com>
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.
Fixes: 473e3150e30a ("bpf, x86: allow function arguments up to 12 for TRACING")
Cc: Hao Peng <flyingpeng@...cent.com>
Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Closes: https://lore.kernel.org/bpf/09784025-a812-493f-9829-5e26c8691e07@moroto.mountain/
Signed-off-by: Menglong Dong <imagedong@...cent.com>
---
arch/x86/net/bpf_jit_comp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
index 5ab531be56ac..83c4b45dc65f 100644
--- a/arch/x86/net/bpf_jit_comp.c
+++ b/arch/x86/net/bpf_jit_comp.c
@@ -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.
--
2.40.1
Powered by blists - more mailing lists