stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: David Ahern <dsahern@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Yafang Shao <laoar.shao@gmail.com>
Cc: bsingharora@gmail.com, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, "David S.Miller" <davem@davemloft.net>
Subject: Re: [PATCH] kernel/taskstats: fix wrong nla type for {cgroup,task}stats policy
Date: Thu, 26 Mar 2020 22:13:19 +0100	[thread overview]
Message-ID: <0db3e8c07fd6a9ec933d62cb045b181d7c832d90.camel@sipsolutions.net> (raw)
In-Reply-To: <ed7c4063-8b45-9fc8-5b92-a903d9da4054@gmail.com> (sfid-20200326_221130_152472_BA2B584D)

On Thu, 2020-03-26 at 15:11 -0600, David Ahern wrote:
> 
> >         na->nla_len = nla_len + 1 + NLA_HDRLEN;
> > 
> > // but this??? the nla_len of a netlink attribute should just be
> > // the len ... what's NLA_HDRLEN doing here? this isn't nested
> > // here we end up just reserving 1+NLA_HDRLEN too much space

[...]

> I do not get the error message with this change as Johannes points out
> above:
> 
> diff --git a/tools/accounting/getdelays.c b/tools/accounting/getdelays.c
> index 8cb504d30384..e90fd133df0e 100644
> --- a/tools/accounting/getdelays.c
> +++ b/tools/accounting/getdelays.c
> @@ -136,7 +136,7 @@ static int send_cmd(int sd, __u16 nlmsg_type, __u32
> nlmsg_pid,
>         msg.g.version = 0x1;
>         na = (struct nlattr *) GENLMSG_DATA(&msg);
>         na->nla_type = nla_type;
> -       na->nla_len = nla_len + 1 + NLA_HDRLEN;
> +       na->nla_len = nla_len + NLA_HDRLEN;

Oops, thanks for the correction - indeed NLA_HDRLEN is included, I was
wrong above.

johannes


  reply	other threads:[~2020-03-26 21:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26  2:50 [PATCH] kernel/taskstats: fix wrong nla type for {cgroup,task}stats policy Yafang Shao
     [not found] ` <20200326130808.ccbacd6cba99a40326936fea@linux-foundation.org>
2020-03-26 20:18   ` Johannes Berg
2020-03-27  0:43     ` Yafang Shao
2020-03-26 20:28   ` Johannes Berg
2020-03-26 21:11     ` David Ahern
2020-03-26 21:13       ` Johannes Berg [this message]
2020-03-27  0:39       ` Yafang Shao
2020-03-27 15:03 ` Sasha Levin

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=0db3e8c07fd6a9ec933d62cb045b181d7c832d90.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=akpm@linux-foundation.org \
    --cc=bsingharora@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).