lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150114090910.GA1869@nanopsycho.orion>
Date:	Wed, 14 Jan 2015 10:09:10 +0100
From:	Jiri Pirko <jiri@...nulli.us>
To:	David Miller <davem@...emloft.net>
Cc:	netdev@...r.kernel.org, jhs@...atatu.com, dborkman@...hat.com,
	ast@...mgrid.com, hannes@...hat.com
Subject: Re: [patch net-next v2] tc: add BPF based action

Tue, Jan 13, 2015 at 08:36:33PM CET, davem@...emloft.net wrote:
>From: Jiri Pirko <jiri@...nulli.us>
>Date: Mon, 12 Jan 2015 17:09:38 +0100
>
>> +	bpf_len = nla_get_u16(tb[TCA_ACT_BPF_OPS_LEN]);
>> +	if (bpf_len > BPF_MAXINSNS || bpf_len == 0)
>> +		return -EINVAL;
>> +
>> +	bpf_size = bpf_len * sizeof(*bpf_ops);
>
>When I see variables named 'len' and 'size', I expect them to be
>in unit bytes.

Size is bytes, len is number of instructions. This is the same as in
net/sched/cls_bpf.c line 182. I follow the same naming for consistency

>
>I think it's clearer to call bpf_len something like "bpf_num_insns",
>or "bpf_num_ops", or something like that.

I understand. I will change it in net/sched/cls_bpf.c as well.

>
>Also, is the OPS_LEN attribute really necessary?  Can't you just
>figure this out using nla_len() on the OPS attribute?  Or is that not
>always accurate due to alignment?

I guess that you could just use nla_len. Again, I followed cls_bpf for
consistency purposes. It has TCA_BPF_OPS_LEN as well.

Thanks for review!

Jiri
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ