sch_gred: kzalloc needs null check
Subsystems (3)
PATCH 1/1 sch_gred: kzalloc needs null check
call to kzalloc may fail and return null. So the result should be checked against null. Added the check to cover kzalloc failure case.
Signed-off-by Navid Emamdoost <[email protected]>
--- net/sched/sch_gred.c | 3 +++ 1 file changed, 3 insertions(+)
net/sched/sch_gred.c +3 -0
@@ -697,6 +697,9 @@ static int gred_change(struct Qdisc *sch, struct nlattr *opt, } prealloc =kzalloc (sizeof (*prealloc),GFP_KERNEL ); +if (!prealloc) +return -ENOMEM ; +sch_tree_lock (sch); err = gred_change_vq(sch, ctl->DP, ctl, prio, stab, max_P, &prealloc,
Signature · 1 line
2.17.1
Quoted 14 lines · Navid Emamdoost
call to kzalloc may fail and return null. So the result should be checked against null. Added the check to cover kzalloc failure case.
Signed-off-by Navid Emamdoost <[email protected]>--- net/sched/sch_gred.c | 3 +++ 1 file changed, 3 insertions(+)net/sched/sch_gred.c +0
-0
net/sched/sch_gred.c static int gred_change(struct Qdisc *sch, struct nlattr *opt, · line 705
Quoted 9 lines
net/sched/sch_gred.c +3
-0@@ -697,6 +697,9 @@ static int gred_change(struct Qdisc *sch, struct nlattr *opt, } prealloc =kzalloc (sizeof (*prealloc),GFP_KERNEL ); +if (!prealloc) +return -ENOMEM ; +sch_tree_lock (sch); err = gred_change_vq(sch, ctl->DP, ctl, prio, stab, max_P, &prealloc,
This seems not needed.
The case is handled later in gred_change_vq()