Skip to content

Commit e160cbc

Browse files
authored
Fix complex atomic instructions handling (capstone-engine#2584)
1 parent 9907b22 commit e160cbc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

arch/BPF/BPFDisassembler.c

+4-2
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,9 @@ static bpf_insn op2insn_ld_ebpf(unsigned opcode)
495495
#define COMPLEX_CASE(c) \
496496
case BPF_ATOMIC_##c | BPF_MODE_FETCH: \
497497
if (BPF_SIZE(opcode) == BPF_SIZE_DW) \
498-
return BPF_INS_A##c##64;
498+
return BPF_INS_A##c##64; \
499+
else \
500+
return BPF_INS_INVALID;
499501

500502
#define CASE(c) \
501503
case BPF_SIZE_##c: \
@@ -524,7 +526,7 @@ static bpf_insn op2insn_st(unsigned opcode, const uint32_t imm)
524526
ALU_CASE_FETCH(XOR);
525527
COMPLEX_CASE(XCHG);
526528
COMPLEX_CASE(CMPXCHG);
527-
default: // Could only be reached if complex atomic operation is used without fetch modifier, or not as DW
529+
default: // Reached if complex atomic operation is used without fetch modifier
528530
return BPF_INS_INVALID;
529531
}
530532
}

0 commit comments

Comments
 (0)