bpf: minor cleanups in ebpf code

Besides others, remove redundant comments where the code is self
documenting enough, and properly indent various bpf_verifier_ops
and bpf_prog_type_list declarations. Moreover, remove two exports
that actually have no module user.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Daniel Borkmann 2016-05-13 19:08:26 +02:00 committed by David S. Miller
parent 553eb54444
commit 4936e3528e
2 changed files with 15 additions and 21 deletions

View File

@ -129,14 +129,12 @@ struct bpf_prog *bpf_prog_realloc(struct bpf_prog *fp_old, unsigned int size,
return fp; return fp;
} }
EXPORT_SYMBOL_GPL(bpf_prog_realloc);
void __bpf_prog_free(struct bpf_prog *fp) void __bpf_prog_free(struct bpf_prog *fp)
{ {
kfree(fp->aux); kfree(fp->aux);
vfree(fp); vfree(fp);
} }
EXPORT_SYMBOL_GPL(__bpf_prog_free);
#ifdef CONFIG_BPF_JIT #ifdef CONFIG_BPF_JIT
struct bpf_binary_header * struct bpf_binary_header *

View File

@ -2069,16 +2069,12 @@ tc_cls_act_func_proto(enum bpf_func_id func_id)
static bool __is_valid_access(int off, int size, enum bpf_access_type type) static bool __is_valid_access(int off, int size, enum bpf_access_type type)
{ {
/* check bounds */
if (off < 0 || off >= sizeof(struct __sk_buff)) if (off < 0 || off >= sizeof(struct __sk_buff))
return false; return false;
/* The verifier guarantees that size > 0. */
/* disallow misaligned access */
if (off % size != 0) if (off % size != 0)
return false; return false;
if (size != sizeof(__u32))
/* all __sk_buff fields are __u32 */
if (size != 4)
return false; return false;
return true; return true;