]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: filter: Avoid shadowing variable in bpf_convert_ctx_access()
authorBreno Leitao <leitao@debian.org>
Fri, 28 Feb 2025 18:43:34 +0000 (10:43 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 15 Mar 2025 18:48:27 +0000 (11:48 -0700)
Rename the local variable 'off' to 'offset' to avoid shadowing the existing
'off' variable that is declared as an `int` in the outer scope of
bpf_convert_ctx_access().

This fixes a compiler warning:

 net/core/filter.c:9679:8: warning: declaration shadows a local variable [-Wshadow]

Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://patch.msgid.link/20250228-fix_filter-v1-1-ce13eae66fe9@debian.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
net/core/filter.c

index 827108c6dad9f4c07d1e411920b86e4fdbbd5c10..dcc53ac5c5458f67a422453134665d43d466a02e 100644 (file)
@@ -9637,7 +9637,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
 
        case offsetof(struct __sk_buff, queue_mapping):
                if (type == BPF_WRITE) {
-                       u32 off = bpf_target_off(struct sk_buff, queue_mapping, 2, target_size);
+                       u32 offset = bpf_target_off(struct sk_buff, queue_mapping, 2, target_size);
 
                        if (BPF_CLASS(si->code) == BPF_ST && si->imm >= NO_QUEUE_MAPPING) {
                                *insn++ = BPF_JMP_A(0); /* noop */
@@ -9646,7 +9646,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
 
                        if (BPF_CLASS(si->code) == BPF_STX)
                                *insn++ = BPF_JMP_IMM(BPF_JGE, si->src_reg, NO_QUEUE_MAPPING, 1);
-                       *insn++ = BPF_EMIT_STORE(BPF_H, si, off);
+                       *insn++ = BPF_EMIT_STORE(BPF_H, si, offset);
                } else {
                        *insn++ = BPF_LDX_MEM(BPF_H, si->dst_reg, si->src_reg,
                                              bpf_target_off(struct sk_buff,