Fix a number of warnings

This commit is contained in:
Jeremy Soller
2021-11-29 20:01:27 -07:00
parent 61279db991
commit 515cab03eb
11 changed files with 31 additions and 37 deletions
+1 -1
View File
@@ -35,7 +35,7 @@ fn validate(address: usize, size: usize, writable: bool) -> Result<()> {
pub unsafe fn validate_ref<T>(ptr: *const T, size: usize) -> Result<&'static T> {
if size == mem::size_of::<T>() {
validate(ptr as usize, mem::size_of::<T>(), false)?;
Ok(unsafe { &*ptr })
Ok(&*ptr)
} else {
Err(Error::new(EINVAL))
}