Fail if funmap's length isn't page size divisible.

This commit is contained in:
4lDO2
2022-07-10 15:21:33 +02:00
parent 60e3e0af34
commit b141cdaad2

View File

@@ -471,7 +471,7 @@ pub fn fstat(fd: FileHandle, stat: &mut Stat) -> Result<usize> {
pub fn funmap(virtual_address: usize, length: usize) -> Result<usize> {
if virtual_address == 0 || length == 0 {
return Ok(0);
} else if virtual_address % PAGE_SIZE != 0 {
} else if virtual_address % PAGE_SIZE != 0 || length % PAGE_SIZE != 0 {
return Err(Error::new(EINVAL));
}