aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_gact.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/act_gact.c')
-rw-r--r--net/sched/act_gact.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index df214d47fc92..422872c4f14b 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -53,6 +53,11 @@ typedef int (*g_rand)(struct tcf_gact *gact);
53static g_rand gact_rand[MAX_RAND]= { NULL, gact_net_rand, gact_determ }; 53static g_rand gact_rand[MAX_RAND]= { NULL, gact_net_rand, gact_determ };
54#endif /* CONFIG_GACT_PROB */ 54#endif /* CONFIG_GACT_PROB */
55 55
56static const struct nla_policy gact_policy[TCA_GACT_MAX + 1] = {
57 [TCA_GACT_PARMS] = { .len = sizeof(struct tc_gact) },
58 [TCA_GACT_PROB] = { .len = sizeof(struct tc_gact_p) },
59};
60
56static int tcf_gact_init(struct nlattr *nla, struct nlattr *est, 61static int tcf_gact_init(struct nlattr *nla, struct nlattr *est,
57 struct tc_action *a, int ovr, int bind) 62 struct tc_action *a, int ovr, int bind)
58{ 63{
@@ -66,20 +71,16 @@ static int tcf_gact_init(struct nlattr *nla, struct nlattr *est,
66 if (nla == NULL) 71 if (nla == NULL)
67 return -EINVAL; 72 return -EINVAL;
68 73
69 err = nla_parse_nested(tb, TCA_GACT_MAX, nla, NULL); 74 err = nla_parse_nested(tb, TCA_GACT_MAX, nla, gact_policy);
70 if (err < 0) 75 if (err < 0)
71 return err; 76 return err;
72 77
73 if (tb[TCA_GACT_PARMS] == NULL || 78 if (tb[TCA_GACT_PARMS] == NULL)
74 nla_len(tb[TCA_GACT_PARMS]) < sizeof(*parm))
75 return -EINVAL; 79 return -EINVAL;
76 parm = nla_data(tb[TCA_GACT_PARMS]); 80 parm = nla_data(tb[TCA_GACT_PARMS]);
77 81
82#ifndef CONFIG_GACT_PROB
78 if (tb[TCA_GACT_PROB] != NULL) 83 if (tb[TCA_GACT_PROB] != NULL)
79#ifdef CONFIG_GACT_PROB
80 if (nla_len(tb[TCA_GACT_PROB]) < sizeof(struct tc_gact_p))
81 return -EINVAL;
82#else
83 return -EOPNOTSUPP; 84 return -EOPNOTSUPP;
84#endif 85#endif
85 86