sched: Avoid NULL pointer in the function, qdisc_get_rtab
Subsystems (2)
Quoted 11 lines · Jamal Hadi Salim
Quoted 9 lines · Nicholas Krause
net/sched/sch_api.c +0
-0@@ -400,7 +400,7 @@ struct qdisc_rate_table *qdisc_get_rtab(struct
tc_ratespec*r, struct nlattr *ta}
Quoted 12 lines
net/sched/sch_api.c
Quoted 7 lines
rtab = kmalloc(sizeof(*rtab), GFP_KERNEL);net/sched/sch_api.c +1
-1-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
Quoted 7 lines · Nicholas Krause
net/sched/sch_api.c +0
-0
net/sched/sch_api.c struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *ta · line 406
Quoted 8 lines
net/sched/sch_api.c +1
-1@@ -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