From: Alexey Dobriyan <adobriyan@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH net-next] netlink: gc useless variable in nlmsg_attrdata()
Date: Fri, 13 Aug 2021 08:27:30 +0300 [thread overview]
Message-ID: <YRYCwjh+5CpccgI8@localhost.localdomain> (raw)
In-Reply-To: <20210812150552.18f32fb2@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
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);
> > }
> >
> > /**
>
next prev parent reply other threads:[~2021-08-13 5:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2021-08-13 17:29 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YRYCwjh+5CpccgI8@localhost.localdomain \
--to=adobriyan@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox