Index: sandbox/linux/seccomp-bpf/sandbox_bpf.cc |
diff --git a/sandbox/linux/seccomp-bpf/sandbox_bpf.cc b/sandbox/linux/seccomp-bpf/sandbox_bpf.cc |
index 31ccda259488983ae902173c7ef450a6599659ea..399087c368ed58482901feaae73ab74709929d6f 100644 |
--- a/sandbox/linux/seccomp-bpf/sandbox_bpf.cc |
+++ b/sandbox/linux/seccomp-bpf/sandbox_bpf.cc |
@@ -888,10 +888,14 @@ Instruction* SandboxBPF::AssembleJumpTable(CodeGen* gen, |
} |
Instruction* SandboxBPF::RetExpression(CodeGen* gen, const ErrorCode& err) { |
- if (err.error_type_ == ErrorCode::ET_COND) { |
- return CondExpression(gen, err); |
- } else { |
- return gen->MakeInstruction(BPF_RET + BPF_K, err); |
+ switch (err.error_type()) { |
+ case ErrorCode::ET_COND: |
+ return CondExpression(gen, err); |
+ case ErrorCode::ET_SIMPLE: |
+ case ErrorCode::ET_TRAP: |
+ return gen->MakeInstruction(BPF_RET + BPF_K, err.err()); |
+ default: |
+ SANDBOX_DIE("ErrorCode is not suitable for returning from a BPF program"); |
} |
} |