netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] netlink: gc useless variable in nlmsg_attrdata()
@ 2021-08-12 21:24 Alexey Dobriyan
  2021-08-12 22:05 ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Alexey Dobriyan @ 2021-08-12 21:24 UTC (permalink / raw)
  To: davem; +Cc: netdev

Kernel permits pointer arithmetic on "void*" so might as well use it
without casts back and forth.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 include/net/netlink.h |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -587,8 +587,7 @@ static inline int nlmsg_len(const struct nlmsghdr *nlh)
 static inline struct nlattr *nlmsg_attrdata(const struct nlmsghdr *nlh,
 					    int hdrlen)
 {
-	unsigned char *data = nlmsg_data(nlh);
-	return (struct nlattr *) (data + NLMSG_ALIGN(hdrlen));
+	return nlmsg_data(nlh) + NLMSG_ALIGN(hdrlen);
 }
 
 /**

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

end of thread, other threads:[~2021-08-13 17:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-12 21:24 [PATCH net-next] netlink: gc useless variable in nlmsg_attrdata() Alexey Dobriyan
2021-08-12 22:05 ` Jakub Kicinski
2021-08-13  5:27   ` Alexey Dobriyan
2021-08-13 17:29     ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).