* [PATCH net-next] net: filter: Avoid shadowing variable in bpf_convert_ctx_access()
@ 2025-02-28 18:43 Breno Leitao
2025-02-28 18:55 ` Yonghong Song
2025-03-03 23:36 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Breno Leitao @ 2025-02-28 18:43 UTC (permalink / raw)
To: Martin KaFai Lau, Daniel Borkmann, John Fastabend,
Alexei Starovoitov, Andrii Nakryiko, Eduard Zingerman, Song Liu,
Yonghong Song, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Simon Horman
Cc: bpf, netdev, linux-kernel, Breno Leitao
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>
---
net/core/filter.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index 2ec162dd83c46..c23c969cf7d83 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -9635,7 +9635,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 */
@@ -9644,7 +9644,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,
---
base-commit: 76544811c850a1f4c055aa182b513b7a843868ea
change-id: 20250228-fix_filter-5385ff6e154b
Best regards,
--
Breno Leitao <leitao@debian.org>
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: filter: Avoid shadowing variable in bpf_convert_ctx_access()
2025-02-28 18:43 [PATCH net-next] net: filter: Avoid shadowing variable in bpf_convert_ctx_access() Breno Leitao
@ 2025-02-28 18:55 ` Yonghong Song
2025-03-03 23:36 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2025-02-28 18:55 UTC (permalink / raw)
To: Breno Leitao, Martin KaFai Lau, Daniel Borkmann, John Fastabend,
Alexei Starovoitov, Andrii Nakryiko, Eduard Zingerman, Song Liu,
KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman
Cc: bpf, netdev, linux-kernel
On 2/28/25 10:43 AM, Breno Leitao wrote:
> 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>
Make sense to me.
Acked-by: Yonghong Song <yonghong.song@linux.dev>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net: filter: Avoid shadowing variable in bpf_convert_ctx_access()
2025-02-28 18:43 [PATCH net-next] net: filter: Avoid shadowing variable in bpf_convert_ctx_access() Breno Leitao
2025-02-28 18:55 ` Yonghong Song
@ 2025-03-03 23:36 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-03 23:36 UTC (permalink / raw)
To: Breno Leitao
Cc: martin.lau, daniel, john.fastabend, ast, andrii, eddyz87, song,
yonghong.song, kpsingh, sdf, haoluo, jolsa, davem, edumazet, kuba,
pabeni, horms, bpf, netdev, linux-kernel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:
On Fri, 28 Feb 2025 10:43:34 -0800 you wrote:
> 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]
>
> [...]
Here is the summary with links:
- [net-next] net: filter: Avoid shadowing variable in bpf_convert_ctx_access()
https://git.kernel.org/bpf/bpf-next/c/122f1fd14f44
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-03 23:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-28 18:43 [PATCH net-next] net: filter: Avoid shadowing variable in bpf_convert_ctx_access() Breno Leitao
2025-02-28 18:55 ` Yonghong Song
2025-03-03 23:36 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).