aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_gred.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/sch_gred.c')
-rw-r--r--net/sched/sch_gred.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index 6b784838a534..365c7d8b17ab 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -430,12 +430,16 @@ static int gred_change(struct Qdisc *sch, struct nlattr *opt)
430 struct gred_sched *table = qdisc_priv(sch); 430 struct gred_sched *table = qdisc_priv(sch);
431 struct tc_gred_qopt *ctl; 431 struct tc_gred_qopt *ctl;
432 struct nlattr *tb[TCA_GRED_MAX + 1]; 432 struct nlattr *tb[TCA_GRED_MAX + 1];
433 int err = -EINVAL, prio = GRED_DEF_PRIO; 433 int err, prio = GRED_DEF_PRIO;
434 u8 *stab; 434 u8 *stab;
435 435
436 if (opt == NULL || nla_parse_nested(tb, TCA_GRED_MAX, opt, NULL)) 436 if (opt == NULL)
437 return -EINVAL; 437 return -EINVAL;
438 438
439 err = nla_parse_nested(tb, TCA_GRED_MAX, opt, NULL);
440 if (err < 0)
441 return err;
442
439 if (tb[TCA_GRED_PARMS] == NULL && tb[TCA_GRED_STAB] == NULL) 443 if (tb[TCA_GRED_PARMS] == NULL && tb[TCA_GRED_STAB] == NULL)
440 return gred_change_table_def(sch, opt); 444 return gred_change_table_def(sch, opt);
441 445
@@ -445,6 +449,7 @@ static int gred_change(struct Qdisc *sch, struct nlattr *opt)
445 nla_len(tb[TCA_GRED_STAB]) < 256) 449 nla_len(tb[TCA_GRED_STAB]) < 256)
446 return -EINVAL; 450 return -EINVAL;
447 451
452 err = -EINVAL;
448 ctl = nla_data(tb[TCA_GRED_PARMS]); 453 ctl = nla_data(tb[TCA_GRED_PARMS]);
449 stab = nla_data(tb[TCA_GRED_STAB]); 454 stab = nla_data(tb[TCA_GRED_STAB]);
450 455
@@ -489,10 +494,15 @@ errout:
489static int gred_init(struct Qdisc *sch, struct nlattr *opt) 494static int gred_init(struct Qdisc *sch, struct nlattr *opt)
490{ 495{
491 struct nlattr *tb[TCA_GRED_MAX + 1]; 496 struct nlattr *tb[TCA_GRED_MAX + 1];
497 int err;
492 498
493 if (opt == NULL || nla_parse_nested(tb, TCA_GRED_MAX, opt, NULL)) 499 if (opt == NULL)
494 return -EINVAL; 500 return -EINVAL;
495 501
502 err = nla_parse_nested(tb, TCA_GRED_MAX, opt, NULL);
503 if (err < 0)
504 return err;
505
496 if (tb[TCA_GRED_PARMS] || tb[TCA_GRED_STAB]) 506 if (tb[TCA_GRED_PARMS] || tb[TCA_GRED_STAB])
497 return -EINVAL; 507 return -EINVAL;
498 508