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
@@ -16,7 +16,7 @@ use crate::paging::{ActivePageTable, TableKind, VirtualAddress};
use crate::syscall::data::TimeSpec;
use crate::syscall::error::{Error, Result, ESRCH, EAGAIN, EFAULT, EINVAL};
use crate::syscall::flag::{FUTEX_WAIT, FUTEX_WAIT64, FUTEX_WAKE, FUTEX_REQUEUE};
use crate::syscall::validate::{validate_array, validate_slice, validate_slice_mut};
use crate::syscall::validate::validate_array;
type FutexList = VecDeque<FutexEntry>;
+3 -4
View File
@@ -87,7 +87,7 @@ pub fn clone(flags: CloneFlags, stack_base: usize) -> Result<ContextId> {
arch = context.arch.clone();
if let Some(ref fx) = context.kfx {
let mut new_fx = unsafe {
let new_fx = unsafe {
let new_fx_ptr = crate::ALLOCATOR.alloc(Layout::from_size_align_unchecked(1024, 16));
if new_fx_ptr.is_null() {
// FIXME: It's mildly ironic that the only place where clone can fail with
@@ -339,7 +339,7 @@ pub fn clone(flags: CloneFlags, stack_base: usize) -> Result<ContextId> {
}
let mut active_utable = unsafe { ActivePageTable::new(TableKind::User) };
let mut active_ktable = unsafe { ActivePageTable::new(TableKind::Kernel) };
let active_ktable = unsafe { ActivePageTable::new(TableKind::Kernel) };
let mut new_utable = unsafe {
let frame = allocate_frames(1).ok_or(Error::new(ENOMEM))?;
@@ -916,7 +916,7 @@ pub fn fexec_kernel(fd: FileHandle, args: Box<[Box<[u8]>]>, vars: Box<[Box<[u8]>
(auxv, phdr_grant)
} else {
let phdr_grant = match context::contexts().current().ok_or(Error::new(ESRCH))?.read().grants.write() {
mut grants => {
grants => {
let size = elf.program_headers_size() * elf.program_header_count();
let aligned_size = (size + PAGE_SIZE - 1) / PAGE_SIZE * PAGE_SIZE;
@@ -934,7 +934,6 @@ pub fn fexec_kernel(fd: FileHandle, args: Box<[Box<[u8]>]>, vars: Box<[Box<[u8]>
grant
}
};
let mut auxv = Vec::with_capacity(3);
+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))
}