diff options
-rw-r--r-- | tools/regression/bpf/bpf_filter/bpf_test.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/tools/regression/bpf/bpf_filter/bpf_test.c b/tools/regression/bpf/bpf_filter/bpf_test.c index 40b5af5..aa8762c 100644 --- a/tools/regression/bpf/bpf_filter/bpf_test.c +++ b/tools/regression/bpf/bpf_filter/bpf_test.c @@ -189,20 +189,12 @@ bpf_validate(const struct bpf_insn *f, int len) * Check that memory operations use valid addresses. */ if ((BPF_CLASS(p->code) == BPF_ST || - (BPF_CLASS(p->code) == BPF_LD && - (p->code & 0xe0) == BPF_MEM)) && + BPF_CLASS(p->code) == BPF_STX || + ((BPF_CLASS(p->code) == BPF_LD || + BPF_CLASS(p->code) == BPF_LDX) && + (p->code & 0xe0) == BPF_MEM)) && p->k >= BPF_MEMWORDS) return (0); -#if BPF_VALIDATE > 1 - /* - * XXX JK: BPF_STX and BPF_LDX|BPF_MEM must be checked. - */ - if ((BPF_CLASS(p->code) == BPF_STX || - (BPF_CLASS(p->code) == BPF_LDX && - (p->code & 0xe0) == BPF_MEM)) && - p->k >= BPF_MEMWORDS) - return (0); -#endif /* * Check for constant division by 0. */ |