Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH net-next] tun: add missing rcu annotation in tun_set_ebpf()
@ 2020-07-31  4:17 Jason Wang
  2020-08-01  0:18 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Wang @ 2020-07-31  4:17 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, mst, Jason Wang

We expecte prog_p to be protected by rcu, so adding the rcu annotation
to fix the following sparse warning:

drivers/net/tun.c:3003:36: warning: incorrect type in argument 2 (different address spaces)
drivers/net/tun.c:3003:36:    expected struct tun_prog [noderef] __rcu **prog_p
drivers/net/tun.c:3003:36:    got struct tun_prog **prog_p
drivers/net/tun.c:3292:42: warning: incorrect type in argument 2 (different address spaces)
drivers/net/tun.c:3292:42:    expected struct tun_prog **prog_p
drivers/net/tun.c:3292:42:    got struct tun_prog [noderef] __rcu **
drivers/net/tun.c:3296:42: warning: incorrect type in argument 2 (different address spaces)
drivers/net/tun.c:3296:42:    expected struct tun_prog **prog_p
drivers/net/tun.c:3296:42:    got struct tun_prog [noderef] __rcu **

Reported-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/net/tun.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 7adeb91bd368..9b4b25358f9b 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2983,7 +2983,7 @@ static int tun_set_queue(struct file *file, struct ifreq *ifr)
 	return ret;
 }
 
-static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog **prog_p,
+static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog __rcu **prog_p,
 			void __user *data)
 {
 	struct bpf_prog *prog;
-- 
2.18.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] tun: add missing rcu annotation in tun_set_ebpf()
  2020-07-31  4:17 [PATCH net-next] tun: add missing rcu annotation in tun_set_ebpf() Jason Wang
@ 2020-08-01  0:18 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-08-01  0:18 UTC (permalink / raw)
  To: jasowang; +Cc: kuba, netdev, linux-kernel, mst

From: Jason Wang <jasowang@redhat.com>
Date: Fri, 31 Jul 2020 00:17:20 -0400

> We expecte prog_p to be protected by rcu, so adding the rcu annotation
> to fix the following sparse warning:
> 
> drivers/net/tun.c:3003:36: warning: incorrect type in argument 2 (different address spaces)
> drivers/net/tun.c:3003:36:    expected struct tun_prog [noderef] __rcu **prog_p
> drivers/net/tun.c:3003:36:    got struct tun_prog **prog_p
> drivers/net/tun.c:3292:42: warning: incorrect type in argument 2 (different address spaces)
> drivers/net/tun.c:3292:42:    expected struct tun_prog **prog_p
> drivers/net/tun.c:3292:42:    got struct tun_prog [noderef] __rcu **
> drivers/net/tun.c:3296:42: warning: incorrect type in argument 2 (different address spaces)
> drivers/net/tun.c:3296:42:    expected struct tun_prog **prog_p
> drivers/net/tun.c:3296:42:    got struct tun_prog [noderef] __rcu **
> 
> Reported-by: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-31  4:17 [PATCH net-next] tun: add missing rcu annotation in tun_set_ebpf() Jason Wang
2020-08-01  0:18 ` David Miller

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git