Skip to content

Commit

Permalink
re-write two armed match to if let Some() else
Browse files Browse the repository at this point in the history
  • Loading branch information
seanyoung committed Dec 3, 2024
1 parent 8355961 commit 424c886
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions programs/bpf_loader/src/syscalls/mem_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,13 +510,12 @@ impl<'a> Iterator for MemoryChunkIterator<'a> {
}
}

match self.is_account {
None => self.is_account = Some(region_is_account),
Some(is_account) => {
if is_account != region_is_account {
return Some(Err(SyscallError::InvalidLength.into()));
}
if let Some(is_account) = self.is_account {
if is_account != region_is_account {
return Some(Err(SyscallError::InvalidLength.into()));
}
} else {
self.is_account = Some(region_is_account);
}

let vm_addr = self.vm_addr_start;
Expand Down

0 comments on commit 424c886

Please sign in to comment.