* [PATCH bpf-next] net/bpf: Avoid unused "sin_addr_len" warning when CONFIG_CGROUP_BPF is not set
@ 2023-10-13 18:57 Martin KaFai Lau
2023-10-13 19:06 ` Kuniyuki Iwashima
2023-10-13 19:40 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Martin KaFai Lau @ 2023-10-13 18:57 UTC (permalink / raw)
To: bpf
Cc: 'Alexei Starovoitov ', 'Andrii Nakryiko ',
'Daniel Borkmann ', netdev, kernel-team, Stephen Rothwell,
Daan De Meyer
From: Martin KaFai Lau <martin.lau@kernel.org>
It was reported that there is a compiler warning on the unused variable
"sin_addr_len" in af_inet.c when CONFIG_CGROUP_BPF is not set.
This patch is to address it similar to the ipv6 counterpart
in inet6_getname(). It is to "return sin_addr_len;"
instead of "return sizeof(*sin);".
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Closes: https://lore.kernel.org/bpf/20231013114007.2fb09691@canb.auug.org.au/
Cc: Daan De Meyer <daan.j.demeyer@gmail.com>
Fixes: fefba7d1ae19 ("bpf: Propagate modified uaddrlen from cgroup sockaddr programs")
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
---
net/ipv4/af_inet.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 7e27ad37b939..5ce275b2d7ef 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -814,7 +814,7 @@ int inet_getname(struct socket *sock, struct sockaddr *uaddr,
}
release_sock(sk);
memset(sin->sin_zero, 0, sizeof(sin->sin_zero));
- return sizeof(*sin);
+ return sin_addr_len;
}
EXPORT_SYMBOL(inet_getname);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] net/bpf: Avoid unused "sin_addr_len" warning when CONFIG_CGROUP_BPF is not set
2023-10-13 18:57 [PATCH bpf-next] net/bpf: Avoid unused "sin_addr_len" warning when CONFIG_CGROUP_BPF is not set Martin KaFai Lau
@ 2023-10-13 19:06 ` Kuniyuki Iwashima
2023-10-13 19:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Kuniyuki Iwashima @ 2023-10-13 19:06 UTC (permalink / raw)
To: martin.lau
Cc: andrii, ast, bpf, daan.j.demeyer, daniel, kernel-team, netdev,
sfr, Kuniyuki Iwashima
From: Martin KaFai Lau <martin.lau@linux.dev>
Date: Fri, 13 Oct 2023 11:57:02 -0700
> From: Martin KaFai Lau <martin.lau@kernel.org>
>
> It was reported that there is a compiler warning on the unused variable
> "sin_addr_len" in af_inet.c when CONFIG_CGROUP_BPF is not set.
> This patch is to address it similar to the ipv6 counterpart
> in inet6_getname(). It is to "return sin_addr_len;"
> instead of "return sizeof(*sin);".
>
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Closes: https://lore.kernel.org/bpf/20231013114007.2fb09691@canb.auug.org.au/
> Cc: Daan De Meyer <daan.j.demeyer@gmail.com>
> Fixes: fefba7d1ae19 ("bpf: Propagate modified uaddrlen from cgroup sockaddr programs")
> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Thanks!
> ---
> net/ipv4/af_inet.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
> index 7e27ad37b939..5ce275b2d7ef 100644
> --- a/net/ipv4/af_inet.c
> +++ b/net/ipv4/af_inet.c
> @@ -814,7 +814,7 @@ int inet_getname(struct socket *sock, struct sockaddr *uaddr,
> }
> release_sock(sk);
> memset(sin->sin_zero, 0, sizeof(sin->sin_zero));
> - return sizeof(*sin);
> + return sin_addr_len;
> }
> EXPORT_SYMBOL(inet_getname);
>
> --
> 2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH bpf-next] net/bpf: Avoid unused "sin_addr_len" warning when CONFIG_CGROUP_BPF is not set
2023-10-13 18:57 [PATCH bpf-next] net/bpf: Avoid unused "sin_addr_len" warning when CONFIG_CGROUP_BPF is not set Martin KaFai Lau
2023-10-13 19:06 ` Kuniyuki Iwashima
@ 2023-10-13 19:40 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-10-13 19:40 UTC (permalink / raw)
To: Martin KaFai Lau
Cc: bpf, ast, andrii, daniel, netdev, kernel-team, sfr,
daan.j.demeyer
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Fri, 13 Oct 2023 11:57:02 -0700 you wrote:
> From: Martin KaFai Lau <martin.lau@kernel.org>
>
> It was reported that there is a compiler warning on the unused variable
> "sin_addr_len" in af_inet.c when CONFIG_CGROUP_BPF is not set.
> This patch is to address it similar to the ipv6 counterpart
> in inet6_getname(). It is to "return sin_addr_len;"
> instead of "return sizeof(*sin);".
>
> [...]
Here is the summary with links:
- [bpf-next] net/bpf: Avoid unused "sin_addr_len" warning when CONFIG_CGROUP_BPF is not set
https://git.kernel.org/bpf/bpf-next/c/9c1292eca243
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:[~2023-10-13 19:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-13 18:57 [PATCH bpf-next] net/bpf: Avoid unused "sin_addr_len" warning when CONFIG_CGROUP_BPF is not set Martin KaFai Lau
2023-10-13 19:06 ` Kuniyuki Iwashima
2023-10-13 19:40 ` 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).