diff options
author | Kumar Kartikeya Dwivedi | 2021-06-19 09:44:54 +0530 |
---|---|---|
committer | Daniel Borkmann | 2021-06-22 17:04:02 +0200 |
commit | ee62a5c6bb100b6fb07f3da3818c10a24d440e10 (patch) | |
tree | 270269a64537986921e4e3338ae5594395b04be1 /tools/lib/bpf/nlattr.h | |
parent | 0ae64fb6b645e0f976e08bc3c05e518856f19d00 (diff) |
libbpf: Switch to void * casting in netlink helpers
Netlink helpers I added in 8bbb77b7c7a2 ("libbpf: Add various netlink
helpers") used char * casts everywhere, and there were a few more that
existed from before.
Convert all of them to void * cast, as it is treated equivalently by
clang/gcc for the purposes of pointer arithmetic and to follow the
convention elsewhere in the kernel/libbpf.
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20210619041454.417577-2-memxor@gmail.com
Diffstat (limited to 'tools/lib/bpf/nlattr.h')
-rw-r--r-- | tools/lib/bpf/nlattr.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/lib/bpf/nlattr.h b/tools/lib/bpf/nlattr.h index 76cbfeb21955..4d15ae2ff812 100644 --- a/tools/lib/bpf/nlattr.h +++ b/tools/lib/bpf/nlattr.h @@ -81,7 +81,7 @@ struct libbpf_nla_req { */ static inline void *libbpf_nla_data(const struct nlattr *nla) { - return (char *) nla + NLA_HDRLEN; + return (void *)nla + NLA_HDRLEN; } static inline uint8_t libbpf_nla_getattr_u8(const struct nlattr *nla) @@ -118,12 +118,12 @@ int libbpf_nla_dump_errormsg(struct nlmsghdr *nlh); static inline struct nlattr *nla_data(struct nlattr *nla) { - return (struct nlattr *)((char *)nla + NLA_HDRLEN); + return (struct nlattr *)((void *)nla + NLA_HDRLEN); } static inline struct nlattr *req_tail(struct libbpf_nla_req *req) { - return (struct nlattr *)((char *)req + NLMSG_ALIGN(req->nh.nlmsg_len)); + return (struct nlattr *)((void *)req + NLMSG_ALIGN(req->nh.nlmsg_len)); } static inline int nlattr_add(struct libbpf_nla_req *req, int type, @@ -158,7 +158,7 @@ static inline struct nlattr *nlattr_begin_nested(struct libbpf_nla_req *req, int static inline void nlattr_end_nested(struct libbpf_nla_req *req, struct nlattr *tail) { - tail->nla_len = (char *)req_tail(req) - (char *)tail; + tail->nla_len = (void *)req_tail(req) - (void *)tail; } #endif /* __LIBBPF_NLATTR_H */ |