Skip to contentSkip to conversation

linux-next: build warning after merge of the bpf-next tree

DISCUSSION Stephen Rothwell 2 participants 3 messages Oct 13, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hi all,

After merging the bpf-next tree, today's linux-next build (arm multi_v7_defconfig) produced this warning:

net/ipv4/af_inet.c: In function 'inet_getname':
net/ipv4/af_inet.c:791:13: warning: unused variable 'sin_addr_len' [-Wunused-variable]

  791 |         int sin_addr_len = sizeof(*sin);
      |             ^~~~~~~~~~~~

Introduced by commit

fefba7d1ae19 ("bpf: Propagate modified uaddrlen from cgroup sockaddr programs")

Signature · 2 lines
Cheers,
Stephen Rothwell
#1 lore raw

Hi all,

Quoted 4 lines · On Fri, 13 Oct 2023 11:40:07 +1100 Stephen Rothwell <[email protected]>…

After merging the bpf-next tree, today's linux-next build (arm multi_v7_defconfig) produced this warning:

Quoted 8 lines

net/ipv4/af_inet.c: In function 'inet_getname':
net/ipv4/af_inet.c:791:13: warning: unused variable 'sin_addr_len' [-Wunused-variable]

  791 |         int sin_addr_len = sizeof(*sin);
      |             ^~~~~~~~~~~~

Introduced by commit

fefba7d1ae19 ("bpf: Propagate modified uaddrlen from cgroup sockaddr programs")

This became a build failure for the i386 defconfig build, so I applied the following patch:

From: Stephen Rothwell <[email protected]>
Date: Fri, 13 Oct 2023 16:25:08 +1100
Subject: [PATCH] fix up for "bpf: Propagate modified uaddrlen from cgroup sockaddr programs"

---
 net/ipv4/af_inet.c | 2 ++
 1 file changed, 2 insertions(+)
net/ipv4/af_inet.c +2 -0
index 7e27ad37b939..0fcab6b6cb04 100644
@@ -788,7 +788,9 @@ int inet_getname(struct socket *sock, struct sockaddr *uaddr,
 	struct sock *sk		= sock->sk;
 	struct inet_sock *inet	= inet_sk(sk);
 	DECLARE_SOCKADDR(struct sockaddr_in *, sin, uaddr);
+#ifdef CONFIG_CGROUP_BPF
 	int sin_addr_len = sizeof(*sin);
+#endif
 
 	sin->sin_family = AF_INET;
 	lock_sock(sk);
Signature · 5 lines
2.40.1

-- 
Cheers,
Stephen Rothwell
#2 lore raw
Quoted 33 lines · Stephen Rothwell

Hi all,

Quoted 4 lines · On Fri, 13 Oct 2023 11:40:07 +1100 Stephen Rothwell <[email protected]>…

After merging the bpf-next tree, today's linux-next build (arm multi_v7_defconfig) produced this warning:

Quoted 8 lines

net/ipv4/af_inet.c: In function 'inet_getname':
net/ipv4/af_inet.c:791:13: warning: unused variable 'sin_addr_len' [-Wunused-variable]

   791 |         int sin_addr_len = sizeof(*sin);
       |             ^~~~~~~~~~~~

Introduced by commit

fefba7d1ae19 ("bpf: Propagate modified uaddrlen from cgroup sockaddr programs")

This became a build failure for the i386 defconfig build, so I applied the following patch:

From: Stephen Rothwell <[email protected]>
Date: Fri, 13 Oct 2023 16:25:08 +1100
Subject: [PATCH] fix up for "bpf: Propagate modified uaddrlen from cgroup sockaddr programs"

---
  net/ipv4/af_inet.c | 2 ++
  1 file changed, 2 insertions(+)
net/ipv4/af_inet.c +0 -0
index 7e27ad37b939..0fcab6b6cb04 100644

net/ipv4/af_inet.c int inet_getname(struct socket *sock, struct sockaddr *uaddr, · line 793

Quoted 6 lines
net/ipv4/af_inet.c +2 -0
@@ -788,7 +788,9 @@ int inet_getname(struct socket *sock, struct sockaddr *uaddr,
  	struct sock *sk		= sock->sk;
  	struct inet_sock *inet	= inet_sk(sk);
  	DECLARE_SOCKADDR(struct sockaddr_in *, sin, uaddr);
+#ifdef CONFIG_CGROUP_BPF
  	int sin_addr_len = sizeof(*sin);
+#endif

Thanks for the report and taking care of it.

Daan, something that was missed in ipv4 getname. It should be done similar to inet6_getname() in af_inet6.c such that it "return sin_addr_len;" in this function to avoid the compiler warning here in ipv4.