[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YRYCwjh+5CpccgI8@localhost.localdomain>
Date: Fri, 13 Aug 2021 08:27:30 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH net-next] netlink: gc useless variable in nlmsg_attrdata()
On Thu, Aug 12, 2021 at 03:05:52PM -0700, Jakub Kicinski wrote:
> On Fri, 13 Aug 2021 00:24:01 +0300 Alexey Dobriyan wrote:
> > Kernel permits pointer arithmetic on "void*" so might as well use it
> > without casts back and forth.
>
> But why change existing code? It's perfectly fine, right?
It is harder to read (marginally of course).
> > --- 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);
> > }
> >
> > /**
>
Powered by blists - more mailing lists