summaryrefslogtreecommitdiff
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2020-08-18 18:07:09 -0700
committerAlexei Starovoitov <ast@kernel.org>2020-08-19 14:02:49 -0700
commitb558b6c24068d87ffcd95dad3bf0d9bd2ac290e9 (patch)
tree3087016afa79360897607b3ac0c61f103cfadd98 /drivers/net/tun.c
parent37081156149fd532d534efd8ea99ca362ed62e5b (diff)
net-tun: Add type safety to tun_xdp_to_ptr() and tun_ptr_to_xdp()
This reduces likelihood of incorrect use. Test: builds Signed-off-by: Maciej Żenczykowski <maze@google.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200819010710.3959310-1-zenczykowski@gmail.com
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 3c11a77f5709..5dd7f353eeef 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -225,13 +225,13 @@ bool tun_is_xdp_frame(void *ptr)
}
EXPORT_SYMBOL(tun_is_xdp_frame);
-void *tun_xdp_to_ptr(void *ptr)
+void *tun_xdp_to_ptr(struct xdp_frame *xdp)
{
- return (void *)((unsigned long)ptr | TUN_XDP_FLAG);
+ return (void *)((unsigned long)xdp | TUN_XDP_FLAG);
}
EXPORT_SYMBOL(tun_xdp_to_ptr);
-void *tun_ptr_to_xdp(void *ptr)
+struct xdp_frame *tun_ptr_to_xdp(void *ptr)
{
return (void *)((unsigned long)ptr & ~TUN_XDP_FLAG);
}