aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/s390/net
diff options
context:
space:
mode:
authorMichael Holzheu <holzheu@linux.vnet.ibm.com>2015-01-14 11:25:07 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2015-01-15 08:17:42 +0100
commit5a80244246d503df688341a10e1d244d15bb8ce5 (patch)
treee4e39440f18e35b8710b7c515daaba11cbbacabf /arch/s390/net
parentMerge branch 'thermal-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux (diff)
downloadwireguard-linux-5a80244246d503df688341a10e1d244d15bb8ce5.tar.xz
wireguard-linux-5a80244246d503df688341a10e1d244d15bb8ce5.zip
s390/bpf: Fix JMP_JGE_K (A >= K) and JMP_JGT_K (A > K)
Currently the signed COMPARE HALFWORD IMMEDIATE (chi) and COMPARE (c) instructions are used to compare "A" with "K". This is not correct because "A" and "K" are both unsigned. To fix this remove the chi instruction (no unsigned analogon available) and use the unsigned COMPARE LOGICAL (cl) instruction instead of COMPARE (c). Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/net')
-rw-r--r--arch/s390/net/bpf_jit_comp.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/arch/s390/net/bpf_jit_comp.c b/arch/s390/net/bpf_jit_comp.c
index 524496d47ef5..bbd1981cc150 100644
--- a/arch/s390/net/bpf_jit_comp.c
+++ b/arch/s390/net/bpf_jit_comp.c
@@ -448,15 +448,12 @@ static int bpf_jit_insn(struct bpf_jit *jit, struct sock_filter *filter,
mask = 0x800000; /* je */
kbranch: /* Emit compare if the branch targets are different */
if (filter->jt != filter->jf) {
- if (K <= 16383)
- /* chi %r5,<K> */
- EMIT4_IMM(0xa75e0000, K);
- else if (test_facility(21))
+ if (test_facility(21))
/* clfi %r5,<K> */
EMIT6_IMM(0xc25f0000, K);
else
- /* c %r5,<d(K)>(%r13) */
- EMIT4_DISP(0x5950d000, EMIT_CONST(K));
+ /* cl %r5,<d(K)>(%r13) */
+ EMIT4_DISP(0x5550d000, EMIT_CONST(K));
}
branch: if (filter->jt == filter->jf) {
if (filter->jt == 0)