diff options
| author | Maciej Żenczykowski <[email protected]> | 2020-08-18 19:00:27 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2020-08-19 14:10:38 -0700 |
| commit | defcffeb517b3965e64f4e5531db3b452dccbfc5 (patch) | |
| tree | 4f8ce3f51a11609b12481998eb5bef4085a071ac | |
| parent | 596b5ef458f903d4362fb3c69967b6d8a23334bd (diff) | |
net-veth: Add type safety to veth_xdp_to_ptr() and veth_ptr_to_xdp()
This reduces likelihood of incorrect use.
Test: builds
Signed-off-by: Maciej Żenczykowski <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
| -rw-r--r-- | drivers/net/veth.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/net/veth.c b/drivers/net/veth.c index e56cd562a664..b80cbffeb88e 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -234,14 +234,14 @@ static bool veth_is_xdp_frame(void *ptr) return (unsigned long)ptr & VETH_XDP_FLAG; } -static void *veth_ptr_to_xdp(void *ptr) +static struct xdp_frame *veth_ptr_to_xdp(void *ptr) { return (void *)((unsigned long)ptr & ~VETH_XDP_FLAG); } -static void *veth_xdp_to_ptr(void *ptr) +static void *veth_xdp_to_ptr(struct xdp_frame *xdp) { - return (void *)((unsigned long)ptr | VETH_XDP_FLAG); + return (void *)((unsigned long)xdp | VETH_XDP_FLAG); } static void veth_ptr_free(void *ptr) |