Skip to content

Commit 19856a5

Browse files
leitaoAlexei Starovoitov
authored andcommitted
net: filter: Avoid shadowing variable in bpf_convert_ctx_access()
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 <[email protected]> Signed-off-by: Martin KaFai Lau <[email protected]> Acked-by: Yonghong Song <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 282f092 commit 19856a5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/core/filter.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9637,7 +9637,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
96379637

96389638
case offsetof(struct __sk_buff, queue_mapping):
96399639
if (type == BPF_WRITE) {
9640-
u32 off = bpf_target_off(struct sk_buff, queue_mapping, 2, target_size);
9640+
u32 offset = bpf_target_off(struct sk_buff, queue_mapping, 2, target_size);
96419641

96429642
if (BPF_CLASS(si->code) == BPF_ST && si->imm >= NO_QUEUE_MAPPING) {
96439643
*insn++ = BPF_JMP_A(0); /* noop */
@@ -9646,7 +9646,7 @@ static u32 bpf_convert_ctx_access(enum bpf_access_type type,
96469646

96479647
if (BPF_CLASS(si->code) == BPF_STX)
96489648
*insn++ = BPF_JMP_IMM(BPF_JGE, si->src_reg, NO_QUEUE_MAPPING, 1);
9649-
*insn++ = BPF_EMIT_STORE(BPF_H, si, off);
9649+
*insn++ = BPF_EMIT_STORE(BPF_H, si, offset);
96509650
} else {
96519651
*insn++ = BPF_LDX_MEM(BPF_H, si->dst_reg, si->src_reg,
96529652
bpf_target_off(struct sk_buff,

0 commit comments

Comments
 (0)