[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200422144436.GB25914@nautica>
Date: Wed, 22 Apr 2020 16:44:36 +0200
From: Dominique Martinet <asmadeus@...ewreck.org>
To: Jamal Hadi Salim <jhs@...atatu.com>
Cc: stephen@...workplumber.org, netdev@...r.kernel.org,
dsahern@...il.com, aclaudi@...hat.com, daniel@...earbox.net,
Jamal Hadi Salim <hadi@...atatu.com>
Subject: Re: [PATCH iproute2 v2 2/2] bpf: Fix mem leak and extraneous free()
in error path
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
Powered by blists - more mailing lists