summaryrefslogtreecommitdiff
path: root/net/ipv4/af_inet.c
diff options
context:
space:
mode:
authorMartin KaFai Lau <martin.lau@kernel.org>2023-10-13 21:57:02 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-02-01 03:19:09 +0300
commit4690558e756c70af2b8a548a30629794fc59bb5e (patch)
treebc9a115c848893e1db7476920fc74fa129975ba0 /net/ipv4/af_inet.c
parentb565f41b9f20ed65d73660ffa6d8e495bc839789 (diff)
downloadlinux-4690558e756c70af2b8a548a30629794fc59bb5e.tar.xz
net/bpf: Avoid unused "sin_addr_len" warning when CONFIG_CGROUP_BPF is not set
commit 9c1292eca243821249fa99f40175b0660d9329e3 upstream. 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/ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/ipv4/af_inet.c')
-rw-r--r--net/ipv4/af_inet.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 7d4d625471f7..1c58bd72e124 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -823,7 +823,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);