@ -55,7 +55,7 @@ impl Channel {
/// Read a packet from the channel if check is ok, otherwise the msg will keep.
pub fn read(&self) -> ZxResult<T> {
let mut recv_queue = self.recv_queue.lock();
if let Some(_) = recv_queue.front() {
if recv_queue.front().is_some() {
let msg = recv_queue.pop_front().unwrap();
return Ok(msg);
}
@ -277,8 +277,7 @@ impl VmAddressRegion {
let length = inner.mappings.iter().fold(0, |acc, map| {
acc + end_addr
.min(map.end_addr())
.checked_sub(addr.max(map.addr()))
.unwrap_or(0)
.saturating_sub(addr.max(map.addr()))
});
if length != len {
return Err(ZxError::NOT_FOUND);
@ -10,16 +10,9 @@ extern crate log;
use {
alloc::{boxed::Box, sync::Arc, vec::Vec},
core::{future::Future, pin::Pin},
xmas_elf::ElfFile,
zircon_object::{
dev::*,
ipc::*,
object::*,
task::*,
util::elf_loader::*,
vm::*,
},
kernel_hal::MMUFlags,
zircon_object::{dev::*, ipc::*, object::*, task::*, util::elf_loader::*, vm::*},
};
mod kcounter;
@ -56,7 +56,7 @@ impl Channel {
@ -13,12 +13,12 @@ extern crate std;
#[macro_use]
extern crate log;
pub mod dev;
pub mod error;
pub mod ipc;
pub mod object;
pub mod task;
pub mod util;
pub mod vm;
pub use self::error::*;