diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2016-06-28 12:18:23 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-06-30 05:54:40 -0400 |
commit | 1ca1cc98bf7418c680415bfce05699f67510a7fd (patch) | |
tree | c7f9924f35a3645b99208534b887c84077cfb975 /kernel/bpf | |
parent | ee58b57100ca953da7320c285315a95db2f7053d (diff) | |
download | op-kernel-dev-1ca1cc98bf7418c680415bfce05699f67510a7fd.zip op-kernel-dev-1ca1cc98bf7418c680415bfce05699f67510a7fd.tar.gz |
bpf: minor cleanups on fd maps and helpers
Some minor cleanups: i) Remove the unlikely() from fd array map lookups
and let the CPU branch predictor do its job, scenarios where there is not
always a map entry are very well valid. ii) Move the attribute type check
in the bpf_perf_event_read() helper a bit earlier so it's consistent wrt
checks with bpf_perf_event_output() helper as well. iii) remove some
comments that are self-documenting in kprobe_prog_is_valid_access() and
therefore make it consistent to tp_prog_is_valid_access() as well.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf')
-rw-r--r-- | kernel/bpf/core.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index b94a365..d638062 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -719,14 +719,13 @@ select_insn: if (unlikely(index >= array->map.max_entries)) goto out; - if (unlikely(tail_call_cnt > MAX_TAIL_CALL_CNT)) goto out; tail_call_cnt++; prog = READ_ONCE(array->ptrs[index]); - if (unlikely(!prog)) + if (!prog) goto out; /* ARG1 at this point is guaranteed to point to CTX from |