Re: [PATCH v3] net/sched: act_gate: Limit the max value for cycletime

From: Jakub Kicinski

Date: Thu Aug 27 2026 - 15:20:47 EST


On Tue, 25 Aug 2026 20:13:02 +0800 Edward Adam Davis wrote:
> static const struct nla_policy gate_policy[TCA_GATE_MAX + 1] = {
> [TCA_GATE_PARMS] =
> NLA_POLICY_EXACT_LEN(sizeof(struct tc_gate)),
> [TCA_GATE_PRIORITY] = { .type = NLA_S32 },
> [TCA_GATE_ENTRY_LIST] = { .type = NLA_NESTED },
> [TCA_GATE_BASE_TIME] = { .type = NLA_U64 },
> - [TCA_GATE_CYCLE_TIME] = { .type = NLA_U64 },
> + [TCA_GATE_CYCLE_TIME] =
> + NLA_POLICY_FULL_RANGE_SIGNED(NLA_S64, &gate_cycle_time_range),

Why are you changing the type of the attr? S64_MAX is perfectly fine as
range for NLA_U64

> [TCA_GATE_CYCLE_TIME_EXT] = { .type = NLA_U64 },
> [TCA_GATE_FLAGS] = { .type = NLA_U32 },
> [TCA_GATE_CLOCKID] = { .type = NLA_S32 },
> @@ -501,6 +507,7 @@ static int tcf_gate_init(struct net *net, struct nlattr *nla,
> cycle = ktime_add_ns(cycle, entry->interval);
> cycletime = cycle;
> }
> +
> p->tcfg_cycletime = cycletime;
> p->tcfg_cycletime_ext = cycletime_ext;

Unrelated noise, please pay more attention.