Index: sandbox/linux/bpf_dsl/policy_compiler.cc |
diff --git a/sandbox/linux/bpf_dsl/policy_compiler.cc b/sandbox/linux/bpf_dsl/policy_compiler.cc |
index ad100f957994227095aa3458fbd1b4a5b3f40a8f..f0e357a044db9b87026c7c1de5ee39c8b5df3c21 100644 |
--- a/sandbox/linux/bpf_dsl/policy_compiler.cc |
+++ b/sandbox/linux/bpf_dsl/policy_compiler.cc |
@@ -76,8 +76,7 @@ intptr_t BPFFailure(const struct arch_seccomp_data&, void* aux) { |
} |
bool HasUnsafeTraps(const SandboxBPFDSLPolicy* policy) { |
- for (SyscallIterator iter(false); !iter.Done();) { |
- uint32_t sysnum = iter.Next(); |
+ for (uint32_t sysnum : SyscallSet::ALL) { |
if (SyscallIterator::IsValid(sysnum) && |
policy->EvaluateSyscall(sysnum)->HasUnsafeTraps()) { |
return true; |
@@ -89,8 +88,8 @@ bool HasUnsafeTraps(const SandboxBPFDSLPolicy* policy) { |
} // namespace |
struct PolicyCompiler::Range { |
- Range(uint32_t f, uint32_t t, const ErrorCode& e) : from(f), to(t), err(e) {} |
- uint32_t from, to; |
+ Range(uint32_t f, const ErrorCode& e) : from(f), err(e) {} |
+ uint32_t from; |
ErrorCode err; |
}; |
@@ -256,18 +255,18 @@ void PolicyCompiler::FindRanges(Ranges* ranges) { |
? policy_->EvaluateSyscall(old_sysnum)->Compile(this) |
: invalid_err; |
- for (SyscallIterator iter(false); !iter.Done();) { |
- uint32_t sysnum = iter.Next(); |
+ for (uint32_t sysnum : SyscallSet::ALL) { |
ErrorCode err = |
SyscallIterator::IsValid(sysnum) |
? policy_->EvaluateSyscall(static_cast<int>(sysnum))->Compile(this) |
: invalid_err; |
- if (!err.Equals(old_err) || iter.Done()) { |
- ranges->push_back(Range(old_sysnum, sysnum - 1, old_err)); |
+ if (!err.Equals(old_err)) { |
+ ranges->push_back(Range(old_sysnum, old_err)); |
old_sysnum = sysnum; |
old_err = err; |
} |
} |
+ ranges->push_back(Range(old_sysnum, old_err)); |
} |
Instruction* PolicyCompiler::AssembleJumpTable(Ranges::const_iterator start, |