Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tc: cls_bpf: rename bpf_len to bpf_num_ops

It was suggested by DaveM to change the name as "len" might indicate
unit bytes.

Suggested-by: David Miller <davem@davemloft.net>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jiri Pirko and committed by
David S. Miller
33e9fcc6 d23b8ad8

+9 -9
+9 -9
net/sched/cls_bpf.c
··· 37 37 struct tcf_result res; 38 38 struct list_head link; 39 39 u32 handle; 40 - u16 bpf_len; 40 + u16 bpf_num_ops; 41 41 struct tcf_proto *tp; 42 42 struct rcu_head rcu; 43 43 }; ··· 160 160 struct tcf_exts exts; 161 161 struct sock_fprog_kern tmp; 162 162 struct bpf_prog *fp; 163 - u16 bpf_size, bpf_len; 163 + u16 bpf_size, bpf_num_ops; 164 164 u32 classid; 165 165 int ret; 166 166 ··· 173 173 return ret; 174 174 175 175 classid = nla_get_u32(tb[TCA_BPF_CLASSID]); 176 - bpf_len = nla_get_u16(tb[TCA_BPF_OPS_LEN]); 177 - if (bpf_len > BPF_MAXINSNS || bpf_len == 0) { 176 + bpf_num_ops = nla_get_u16(tb[TCA_BPF_OPS_LEN]); 177 + if (bpf_num_ops > BPF_MAXINSNS || bpf_num_ops == 0) { 178 178 ret = -EINVAL; 179 179 goto errout; 180 180 } 181 181 182 - bpf_size = bpf_len * sizeof(*bpf_ops); 182 + bpf_size = bpf_num_ops * sizeof(*bpf_ops); 183 183 bpf_ops = kzalloc(bpf_size, GFP_KERNEL); 184 184 if (bpf_ops == NULL) { 185 185 ret = -ENOMEM; ··· 188 188 189 189 memcpy(bpf_ops, nla_data(tb[TCA_BPF_OPS]), bpf_size); 190 190 191 - tmp.len = bpf_len; 191 + tmp.len = bpf_num_ops; 192 192 tmp.filter = bpf_ops; 193 193 194 194 ret = bpf_prog_create(&fp, &tmp); 195 195 if (ret) 196 196 goto errout_free; 197 197 198 - prog->bpf_len = bpf_len; 198 + prog->bpf_num_ops = bpf_num_ops; 199 199 prog->bpf_ops = bpf_ops; 200 200 prog->filter = fp; 201 201 prog->res.classid = classid; ··· 303 303 304 304 if (nla_put_u32(skb, TCA_BPF_CLASSID, prog->res.classid)) 305 305 goto nla_put_failure; 306 - if (nla_put_u16(skb, TCA_BPF_OPS_LEN, prog->bpf_len)) 306 + if (nla_put_u16(skb, TCA_BPF_OPS_LEN, prog->bpf_num_ops)) 307 307 goto nla_put_failure; 308 308 309 - nla = nla_reserve(skb, TCA_BPF_OPS, prog->bpf_len * 309 + nla = nla_reserve(skb, TCA_BPF_OPS, prog->bpf_num_ops * 310 310 sizeof(struct sock_filter)); 311 311 if (nla == NULL) 312 312 goto nla_put_failure;