]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: don't emit mov A,A on return
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 19 Feb 2016 22:05:27 +0000 (23:05 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 22 Feb 2016 03:07:11 +0000 (22:07 -0500)
commit210a2974489813c398f1d246bfcb57f95a9c85e4
tree78c48c223c2b45253361e929a1bffc291dd16925
parent6612d5ddff15378a2b575798a1af1e8e2e7f00c8
bpf: don't emit mov A,A on return

While debugging with bpf_jit_disasm I noticed emissions of 'mov %eax,%eax',
and found that this comes from BPF_RET | BPF_A translations from classic
BPF. Emitting this is unnecessary as BPF_REG_A is mapped into BPF_REG_0
already, therefore only emit a mov when immediates are used as return value.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/filter.c