* Re: [PATCH] sched: Avoid NULL pointer in the function, qdisc_get_rtab [not found] <1432315985-11857-1-git-send-email-xerofoify@gmail.com> @ 2015-05-26 9:31 ` Jamal Hadi Salim 2015-05-26 11:33 ` Jamal Hadi Salim 0 siblings, 1 reply; 2+ messages in thread From: Jamal Hadi Salim @ 2015-05-26 9:31 UTC (permalink / raw) To: Nicholas Krause; +Cc: davem, netdev 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 ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] sched: Avoid NULL pointer in the function, qdisc_get_rtab 2015-05-26 9:31 ` [PATCH] sched: Avoid NULL pointer in the function, qdisc_get_rtab Jamal Hadi Salim @ 2015-05-26 11:33 ` Jamal Hadi Salim 0 siblings, 0 replies; 2+ messages in thread From: Jamal Hadi Salim @ 2015-05-26 11:33 UTC (permalink / raw) To: Nicholas Krause; +Cc: davem, netdev On 05/26/15 05:31, Jamal Hadi Salim wrote: > 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? > Yikes. Seems i fell for some trolling. Hasnt happened since summer of 94. You got me ;-> cheers, jamal ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-05-26 13:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1432315985-11857-1-git-send-email-xerofoify@gmail.com>
2015-05-26 9:31 ` [PATCH] sched: Avoid NULL pointer in the function, qdisc_get_rtab Jamal Hadi Salim
2015-05-26 11:33 ` Jamal Hadi Salim
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).