[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <55643D55.5070709@mojatatu.com>
Date: Tue, 26 May 2015 05:31:01 -0400
From: Jamal Hadi Salim <jhs@...atatu.com>
To: Nicholas Krause <xerofoify@...il.com>
CC: davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH] sched: Avoid NULL pointer in the function, qdisc_get_rtab
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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists