From: Phil Sutter <phil@nwl.cc>
To: David Laight <David.Laight@ACULAB.COM>
Cc: Stephen Hemminger <stephen@networkplumber.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [iproute PATCH v2 2/3] iproute_lwtunnel: Argument to strerror must be positive
Date: Fri, 18 Aug 2017 13:21:27 +0200 [thread overview]
Message-ID: <20170818112127.GI10864@orbyte.nwl.cc> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DD005A7C8@AcuExch.aculab.com>
On Fri, Aug 18, 2017 at 09:21:34AM +0000, David Laight wrote:
> From: Phil Sutter
> > Sent: 17 August 2017 18:10
> > Signed-off-by: Phil Sutter <phil@nwl.cc>
> > ---
> > ip/iproute_lwtunnel.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
> > index 398ab5e077ed8..1a3dc4d4c0ed9 100644
> > --- a/ip/iproute_lwtunnel.c
> > +++ b/ip/iproute_lwtunnel.c
> > @@ -643,7 +643,7 @@ static int lwt_parse_bpf(struct rtattr *rta, size_t len,
> > err = bpf_parse_common(bpf_type, &cfg, &bpf_cb_ops, &x);
> > if (err < 0) {
> > fprintf(stderr, "Failed to parse eBPF program: %s\n",
> > - strerror(err));
> > + strerror(-err));
>
> If we are in userspace I'd expect errno values to be +ve.
> Returning a -ve errno is very non-standard.
This is because bpf_parse() returns the number of instructions parsed or
a negative return code. We could change it to return instructions * -1
or a positive return code, but that's even more insane than calling
strerror(-err), isn't it?
Cheers, Phil
next prev parent reply other threads:[~2017-08-18 11:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-17 17:09 [iproute PATCH v2 0/3] Covscan: Fixes for obvious programming mistakes Phil Sutter
2017-08-17 17:09 ` [iproute PATCH v2 1/3] iproute_lwtunnel: csum_mode value checking was ineffective Phil Sutter
2017-08-17 17:09 ` [iproute PATCH v2 2/3] iproute_lwtunnel: Argument to strerror must be positive Phil Sutter
2017-08-18 9:21 ` David Laight
2017-08-18 11:21 ` Phil Sutter [this message]
2017-08-17 17:09 ` [iproute PATCH v2 3/3] tipc/node: Fix socket fd check in cmd_node_get_addr() Phil Sutter
2017-08-18 16:15 ` [iproute PATCH v2 0/3] Covscan: Fixes for obvious programming mistakes Stephen Hemminger
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=20170818112127.GI10864@orbyte.nwl.cc \
--to=phil@nwl.cc \
--cc=David.Laight@ACULAB.COM \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.