mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 12:34:31 +00:00
Fixed or_fun_call warnings in kvm/
BUG=chromium:1111728 TEST=cargo clippy -- -A clippy::all -W clippy::or_fun_call passes under kvm directory Change-Id: I7677856f2944f3d4e1c92d2f6ec75763faa5ee42 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2582942 Tested-by: Camilo Jacomet <cjacomet@google.com> Commit-Queue: Camilo Jacomet <cjacomet@google.com> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
parent
74c2381d42
commit
48d1729e2f
2 changed files with 7 additions and 5 deletions
|
@ -128,7 +128,7 @@ impl<'a> MemoryMappingBuilder<'a> {
|
|||
}
|
||||
MemoryMappingBuilder::wrap(SysUtilMmap::new_protection(
|
||||
self.size,
|
||||
self.protection.unwrap_or(Protection::read_write()),
|
||||
self.protection.unwrap_or_else(Protection::read_write),
|
||||
))
|
||||
}
|
||||
Some(descriptor) => {
|
||||
|
@ -136,7 +136,7 @@ impl<'a> MemoryMappingBuilder<'a> {
|
|||
&wrap_descriptor(descriptor),
|
||||
self.size,
|
||||
self.offset.unwrap_or(0),
|
||||
self.protection.unwrap_or(Protection::read_write()),
|
||||
self.protection.unwrap_or_else(Protection::read_write),
|
||||
self.populate,
|
||||
))
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ impl<'a> MemoryMappingBuilder<'a> {
|
|||
None => MemoryMappingBuilder::wrap(SysUtilMmap::new_protection_fixed(
|
||||
addr,
|
||||
self.size,
|
||||
self.protection.unwrap_or(Protection::read_write()),
|
||||
self.protection.unwrap_or_else(Protection::read_write),
|
||||
)),
|
||||
Some(descriptor) => {
|
||||
MemoryMappingBuilder::wrap(SysUtilMmap::from_fd_offset_protection_fixed(
|
||||
|
@ -169,7 +169,7 @@ impl<'a> MemoryMappingBuilder<'a> {
|
|||
&wrap_descriptor(descriptor),
|
||||
self.size,
|
||||
self.offset.unwrap_or(0),
|
||||
self.protection.unwrap_or(Protection::read_write()),
|
||||
self.protection.unwrap_or_else(Protection::read_write),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -330,7 +330,9 @@ impl Vm {
|
|||
log_dirty_pages: bool,
|
||||
) -> Result<u32> {
|
||||
let size = mem.size() as u64;
|
||||
let end_addr = guest_addr.checked_add(size).ok_or(Error::new(EOVERFLOW))?;
|
||||
let end_addr = guest_addr
|
||||
.checked_add(size)
|
||||
.ok_or_else(|| Error::new(EOVERFLOW))?;
|
||||
if self.guest_mem.range_overlap(guest_addr, end_addr) {
|
||||
return Err(Error::new(ENOSPC));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue