From: Jamal Hadi Salim <jhs@mojatatu.com>
To: Nicholas Krause <xerofoify@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: Re: [PATCH] sched: Avoid NULL pointer in the function, qdisc_get_rtab
Date: Tue, 26 May 2015 05:31:01 -0400 [thread overview]
Message-ID: <55643D55.5070709@mojatatu.com> (raw)
In-Reply-To: <1432315985-11857-1-git-send-email-xerofoify@gmail.com>
On 05/22/15 13:33, Nicholas Krause wrote:
>
> diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
> index ad9eed7..44a8995 100644
> --- a/net/sched/sch_api.c
> +++ b/net/sched/sch_api.c
> @@ -400,7 +400,7 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *ta
> }
>
> rtab = kmalloc(sizeof(*rtab), GFP_KERNEL);
> - if (rtab) {
> + if (!rtab) {
> rtab->rate = *r;
> rtab->refcnt = 1;
> memcpy(rtab->data, nla_data(tab), 1024);
>
Did i miss something so clever it is not obvious? ;->
If rtab's kmalloc fails you want to set rtab's fields?
And what is wrong with returning a null rtab again?
cheers,
jamal
next parent reply other threads:[~2015-05-26 13:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1432315985-11857-1-git-send-email-xerofoify@gmail.com>
2015-05-26 9:31 ` Jamal Hadi Salim [this message]
2015-05-26 11:33 ` [PATCH] sched: Avoid NULL pointer in the function, qdisc_get_rtab Jamal Hadi Salim
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=55643D55.5070709@mojatatu.com \
--to=jhs@mojatatu.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=xerofoify@gmail.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).