diff options
author | Michael Holzheu <holzheu@linux.vnet.ibm.com> | 2015-01-14 05:25:07 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2015-01-15 02:17:42 -0500 |
commit | 5a80244246d503df688341a10e1d244d15bb8ce5 (patch) | |
tree | e4e39440f18e35b8710b7c515daaba11cbbacabf /arch/s390 | |
parent | f800c25b7a762d445ba1439a2428c8362157eba6 (diff) |
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')
-rw-r--r-- | arch/s390/net/bpf_jit_comp.c | 9 |
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, | |||
448 | mask = 0x800000; /* je */ | 448 | mask = 0x800000; /* je */ |
449 | kbranch: /* Emit compare if the branch targets are different */ | 449 | kbranch: /* Emit compare if the branch targets are different */ |
450 | if (filter->jt != filter->jf) { | 450 | if (filter->jt != filter->jf) { |
451 | if (K <= 16383) | 451 | if (test_facility(21)) |
452 | /* chi %r5,<K> */ | ||
453 | EMIT4_IMM(0xa75e0000, K); | ||
454 | else if (test_facility(21)) | ||
455 | /* clfi %r5,<K> */ | 452 | /* clfi %r5,<K> */ |
456 | EMIT6_IMM(0xc25f0000, K); | 453 | EMIT6_IMM(0xc25f0000, K); |
457 | else | 454 | else |
458 | /* c %r5,<d(K)>(%r13) */ | 455 | /* cl %r5,<d(K)>(%r13) */ |
459 | EMIT4_DISP(0x5950d000, EMIT_CONST(K)); | 456 | EMIT4_DISP(0x5550d000, EMIT_CONST(K)); |
460 | } | 457 | } |
461 | branch: if (filter->jt == filter->jf) { | 458 | branch: if (filter->jt == filter->jf) { |
462 | if (filter->jt == 0) | 459 | if (filter->jt == 0) |