From: Dominique Martinet <asmadeus@codewreck.org>
To: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: stephen@networkplumber.org, netdev@vger.kernel.org,
dsahern@gmail.com, aclaudi@redhat.com, daniel@iogearbox.net,
Jamal Hadi Salim <hadi@mojatatu.com>
Subject: Re: [PATCH iproute2 v2 2/2] bpf: Fix mem leak and extraneous free() in error path
Date: Wed, 22 Apr 2020 16:44:36 +0200 [thread overview]
Message-ID: <20200422144436.GB25914@nautica> (raw)
In-Reply-To: <20200422102808.9197-3-jhs@emojatatu.com>
Jamal Hadi Salim wrote on Wed, Apr 22, 2020:
> sub = strtok(rem, "/");
> while (sub) {
> - if (strlen(tmp) + strlen(sub) + 2 > PATH_MAX)
> - return -EINVAL;
> + if (strlen(tmp) + strlen(sub) + 2 > PATH_MAX) {
> + ret = -EINVAL;
> + goto out;
> + }
Now I'm looking at this we're a bit inconsistent with return values in
this function, other error paths return negative value + errno set,
and this only returns -errno.
Digging a bit into callers it looks like errno is the way to go, so
while you're modifying this it might be worth setting errno to EINVAL as
well here?
Cheers & sorry for nitpicking,
--
Dominique
next prev parent reply other threads:[~2020-04-22 14:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-22 10:28 [PATCH iproute2 v2 0/2] bpf: memory access fixes Jamal Hadi Salim
2020-04-22 10:28 ` [PATCH iproute2 v2 1/2] bpf: Fix segfault when custom pinning is used Jamal Hadi Salim
2020-04-22 12:24 ` Andrea Claudi
2020-04-22 14:43 ` Dominique Martinet
2020-04-22 17:07 ` Jamal Hadi Salim
2020-04-22 16:35 ` Stephen Hemminger
2020-04-22 17:19 ` Jamal Hadi Salim
2020-04-23 6:30 ` Dominique Martinet
2020-04-23 17:46 ` Jamal Hadi Salim
2020-04-22 10:28 ` [PATCH iproute2 v2 2/2] bpf: Fix mem leak and extraneous free() in error path Jamal Hadi Salim
2020-04-22 14:44 ` Dominique Martinet [this message]
2020-04-30 5:40 ` [PATCH iproute2 v2 0/2] bpf: memory access fixes 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=20200422144436.GB25914@nautica \
--to=asmadeus@codewreck.org \
--cc=aclaudi@redhat.com \
--cc=daniel@iogearbox.net \
--cc=dsahern@gmail.com \
--cc=hadi@mojatatu.com \
--cc=jhs@mojatatu.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 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).