From: Stanislav Fomichev <sdf@fomichev.me>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Stanislav Fomichev <sdf@google.com>,
netdev@vger.kernel.org, davem@davemloft.net, ast@kernel.org,
daniel@iogearbox.net
Subject: Re: [PATCH bpf] selftests/bpf: fix incorrect users of create_and_get_cgroup
Date: Mon, 7 Jan 2019 08:49:56 -0800 [thread overview]
Message-ID: <20190107164956.GA14250@mini-arch> (raw)
In-Reply-To: <20190105043438.4nr7hxc4gbqayp5v@ast-mbp.dhcp.thefacebook.com>
On 01/04, Alexei Starovoitov wrote:
> On Thu, Jan 03, 2019 at 10:57:17AM -0800, Stanislav Fomichev wrote:
> > create_and_get_cgroup returns 0 on error, fix the users that assume
> > negative value in case of an error.
> >
> > Signed-off-by: Stanislav Fomichev <sdf@google.com>
> > ---
> > tools/testing/selftests/bpf/get_cgroup_id_user.c | 2 +-
> > tools/testing/selftests/bpf/test_sockmap.c | 2 +-
> > 2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/get_cgroup_id_user.c b/tools/testing/selftests/bpf/get_cgroup_id_user.c
> > index e8da7b39158d..dfaa9b353ac3 100644
> > --- a/tools/testing/selftests/bpf/get_cgroup_id_user.c
> > +++ b/tools/testing/selftests/bpf/get_cgroup_id_user.c
> > @@ -64,7 +64,7 @@ int main(int argc, char **argv)
> > return 1;
> >
> > cgroup_fd = create_and_get_cgroup(TEST_CGROUP);
> > - if (CHECK(cgroup_fd < 0, "create_and_get_cgroup", "err %d errno %d\n",
> > + if (CHECK(!cgroup_fd, "create_and_get_cgroup", "err %d errno %d\n",
>
> fd can be zero.
Assumed it was fine for the test where we never close stdin.
> Hence I prefer to fix it the other way to avoid this corner case.
> Pls fix create_and_get_cgroup() to return -1 in case of error.
> The diff will be much bigger, but overall it's imo cleaner.
Agree, will sent a v2 shortly.
> Also pls add Fixes tag.
>
> Thanks
>
prev parent reply other threads:[~2019-01-07 16:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-03 18:57 [PATCH bpf] selftests/bpf: fix incorrect users of create_and_get_cgroup Stanislav Fomichev
2019-01-04 6:44 ` Y Song
2019-01-05 4:34 ` Alexei Starovoitov
2019-01-07 16:49 ` Stanislav Fomichev [this message]
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=20190107164956.GA14250@mini-arch \
--to=sdf@fomichev.me \
--cc=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.com \
/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).