Seccomp/BPFEmitter: Reorder check to avoid integer overflow warning

This commit is contained in:
Ryan Houdek committed 2024-09-08 20:13:14 -07:00
1 parent 1642a0f4d9
commit b80f05dd86
1 file changed
+4 -4
@@ -307,10 +307,6 @@ uint64_t BPFEmitter::HandleEmission(uint32_t flags, const sock_fprog* prog) {
HadError = PredFunc(Result);
if constexpr (CalculateSize) {
CalculatedSize += Result;
}
if (HadError) {
if constexpr (!CalculateSize) {
// Had error, early return and free the memory.
@@ -318,6 +314,10 @@ uint64_t BPFEmitter::HandleEmission(uint32_t flags, const sock_fprog* prog) {
}
return Result;
}
if constexpr (CalculateSize) {
CalculatedSize += Result;
}
}
if constexpr (CalculateSize) {