tun: add missing rcu annotation in tun_set_ebpf()
Subsystems (3)
PATCH 1/1 tun: add missing rcu annotation in tun_set_ebpf()
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_pdrivers/net/tun.c:3003:36: got struct tun_prog **prog_pdrivers/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_pdrivers/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_pdrivers/net/tun.c:3296:42: got struct tun_prog [noderef] __rcu **
--- drivers/net/tun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/tun.c +1 -1
@@ -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;
Signature · 1 line
2.18.1
From: Jason Wang <[email protected]>
Date: Fri, 31 Jul 2020 00:17:20 -0400
Quoted 13 lines
We expecte
prog_pto 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 structtun_prog[noderef]__rcu**prog_pdrivers/net/tun.c:3003:36: got structtun_prog**prog_pdrivers/net/tun.c:3292:42: warning: incorrect type in argument 2 (different address spaces)drivers/net/tun.c:3292:42: expected structtun_prog**prog_pdrivers/net/tun.c:3292:42: got structtun_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 structtun_prog**prog_pdrivers/net/tun.c:3296:42: got structtun_prog[noderef]__rcu**
Quoted 2 lines
Reported-by Michael S. Tsirkin <[email protected]>Signed-off-by Jason Wang <[email protected]>
Applied, thanks.