[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231013190623.46904-1-kuniyu@amazon.com>
Date: Fri, 13 Oct 2023 12:06:23 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <martin.lau@...ux.dev>
CC: <andrii@...nel.org>, <ast@...nel.org>, <bpf@...r.kernel.org>,
<daan.j.demeyer@...il.com>, <daniel@...earbox.net>, <kernel-team@...a.com>,
<netdev@...r.kernel.org>, <sfr@...b.auug.org.au>, Kuniyuki Iwashima
<kuniyu@...zon.com>
Subject: Re: [PATCH bpf-next] net/bpf: Avoid unused "sin_addr_len" warning when CONFIG_CGROUP_BPF is not set
From: Martin KaFai Lau <martin.lau@...ux.dev>
Date: Fri, 13 Oct 2023 11:57:02 -0700
> From: Martin KaFai Lau <martin.lau@...nel.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@...b.auug.org.au>
> Closes: https://lore.kernel.org/bpf/20231013114007.2fb09691@canb.auug.org.au/
> Cc: Daan De Meyer <daan.j.demeyer@...il.com>
> Fixes: fefba7d1ae19 ("bpf: Propagate modified uaddrlen from cgroup sockaddr programs")
> Signed-off-by: Martin KaFai Lau <martin.lau@...nel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@...zon.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
Powered by blists - more mailing lists