net/bpf: Avoid unused "sin_addr_len" warning when CONFIG_CGROUP_BPF is not set
authorMartin KaFai Lau <martin.lau@kernel.org>
Fri, 13 Oct 2023 18:57:02 +0000 (11:57 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 13 Oct 2023 19:35:43 +0000 (12:35 -0700)
commit9c1292eca243821249fa99f40175b0660d9329e3
tree64e64477ba943941f8cf56e3dd7962e6c30f54ed
parent236334aeec0f93217cf9235f2004e61a0a1a5985
net/bpf: Avoid unused "sin_addr_len" warning when CONFIG_CGROUP_BPF is not set

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);".

Fixes: fefba7d1ae19 ("bpf: Propagate modified uaddrlen from cgroup sockaddr programs")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/bpf/20231013185702.3993710-1-martin.lau@linux.dev
Closes: https://lore.kernel.org/bpf/20231013114007.2fb09691@canb.auug.org.au/
net/ipv4/af_inet.c