From: John Fastabend <john.fastabend@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>,
netdev@vger.kernel.org, davem@davemloft.net, jhs@mojatatu.com
Subject: Re: [patch net-next 1/2] net: sched: cls_basic: fix error path in basic_change()
Date: Fri, 05 Dec 2014 08:34:34 -0800 [thread overview]
Message-ID: <5481DE9A.7080100@gmail.com> (raw)
In-Reply-To: <1417795431.15618.6.camel@edumazet-glaptop2.roam.corp.google.com>
On 12/05/2014 08:03 AM, Eric Dumazet wrote:
> On Fri, 2014-12-05 at 07:29 -0800, John Fastabend wrote:
>> On 12/05/2014 06:50 AM, Jiri Pirko wrote:
>>> Signed-off-by: Jiri Pirko <jiri@resnulli.us>
>>> ---
>>> net/sched/cls_basic.c | 5 ++---
>>> 1 file changed, 2 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
>>> index 7cf0a62..5aed341 100644
>>> --- a/net/sched/cls_basic.c
>>> +++ b/net/sched/cls_basic.c
>>> @@ -178,10 +178,9 @@ static int basic_change(struct net *net, struct sk_buff *in_skb,
>>> return -EINVAL;
>>> }
>>>
>>> - err = -ENOBUFS;
>>> fnew = kzalloc(sizeof(*fnew), GFP_KERNEL);
>>> - if (fnew == NULL)
>>> - goto errout;
>>> + if (!fnew)
>>> + return -ENOBUFS;
>>>
>>> tcf_exts_init(&fnew->exts, TCA_BASIC_ACT, TCA_BASIC_POLICE);
>>> err = -EINVAL;
>>>
>>
>> Nice catch, thanks!
>>
>> Reviewed-by: John Fastabend <john.r.fastabend@intel.com>
>
> Sorry, but this looks a cosmetic change, right ?
>
> If it is a fix, we'd like a 'Fixes: ...' tag.
>
>
>
oops, you are right. fnew is null, free'ing the null value
is no issue at all from the error path. And if we are going
to start converting the use of
if (foo == NULL)
to
if (!foo)
in ./net/sched that is OK but not really worth the noise in
my opinion there are a lot of these in the code for quiet
sometime.
Sorry for the noise. I misread it as fixing a free on some
non-null value, which is not the case.
.John
--
John Fastabend Intel Corporation
next prev parent reply other threads:[~2014-12-05 16:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-05 14:50 [patch net-next 1/2] net: sched: cls_basic: fix error path in basic_change() Jiri Pirko
2014-12-05 14:50 ` [patch net-next 2/2] net: sched: cls: use nla_nest_cancel instead of nlmsg_trim Jiri Pirko
2014-12-09 20:42 ` David Miller
2014-12-09 20:48 ` David Miller
2014-12-09 21:23 ` [patch net-next v2] " Jiri Pirko
2014-12-10 2:51 ` David Miller
2014-12-05 15:29 ` [patch net-next 1/2] net: sched: cls_basic: fix error path in basic_change() John Fastabend
2014-12-05 16:03 ` Eric Dumazet
2014-12-05 16:34 ` John Fastabend [this message]
2014-12-08 7:27 ` Jiri Pirko
2014-12-05 17:07 ` Sergei Shtylyov
2014-12-09 20:42 ` David Miller
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=5481DE9A.7080100@gmail.com \
--to=john.fastabend@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=netdev@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).