netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@amazon.com>
To: <martin.lau@linux.dev>
Cc: <andrii@kernel.org>, <ast@kernel.org>, <bpf@vger.kernel.org>,
	<daan.j.demeyer@gmail.com>, <daniel@iogearbox.net>,
	<kernel-team@meta.com>, <netdev@vger.kernel.org>,
	<sfr@canb.auug.org.au>, Kuniyuki Iwashima <kuniyu@amazon.com>
Subject: Re: [PATCH bpf-next] net/bpf: Avoid unused "sin_addr_len" warning when CONFIG_CGROUP_BPF is not set
Date: Fri, 13 Oct 2023 12:06:23 -0700	[thread overview]
Message-ID: <20231013190623.46904-1-kuniyu@amazon.com> (raw)
In-Reply-To: <20231013185702.3993710-1-martin.lau@linux.dev>

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

  reply	other threads:[~2023-10-13 19:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2023-10-13 19:40 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231013190623.46904-1-kuniyu@amazon.com \
    --to=kuniyu@amazon.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daan.j.demeyer@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@meta.com \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).