summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2018-01-26 23:33:36 +0100
committerAlexei Starovoitov <ast@kernel.org>2018-01-26 16:42:05 -0800
commit1d621674d923790d09cab9e2c7da7da6446a6257 (patch)
tree77e833adb01837abf0edc3421b403e9244c9e9b0 /net/core
parentc25ef6a5e62fa212d298ce24995ce239f29b5f96 (diff)
downloadlinux-stable-1d621674d923790d09cab9e2c7da7da6446a6257.tar.gz
linux-stable-1d621674d923790d09cab9e2c7da7da6446a6257.tar.bz2
linux-stable-1d621674d923790d09cab9e2c7da7da6446a6257.zip
bpf: xor of a/x in cbpf can be done in 32 bit alu
Very minor optimization; saves 1 byte per program in x86_64 JIT in cBPF prologue. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/filter.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index fe2c7937351f..60d8c8712652 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -401,8 +401,8 @@ do_pass:
/* Classic BPF expects A and X to be reset first. These need
* to be guaranteed to be the first two instructions.
*/
- *new_insn++ = BPF_ALU64_REG(BPF_XOR, BPF_REG_A, BPF_REG_A);
- *new_insn++ = BPF_ALU64_REG(BPF_XOR, BPF_REG_X, BPF_REG_X);
+ *new_insn++ = BPF_ALU32_REG(BPF_XOR, BPF_REG_A, BPF_REG_A);
+ *new_insn++ = BPF_ALU32_REG(BPF_XOR, BPF_REG_X, BPF_REG_X);
/* All programs must keep CTX in callee saved BPF_REG_CTX.
* In eBPF case it's done by the compiler, here we need to