mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: do not treat libc::MAP_FAILED as a pointer
It will likely be safely rejected by the kernel, but it's still wrong. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
This commit is contained in:
committed by
Rob Bradford
parent
821f7994fc
commit
24998c1672
@@ -2046,7 +2046,15 @@ impl MemoryManager {
|
||||
file.as_raw_fd(),
|
||||
0,
|
||||
)
|
||||
} as u64;
|
||||
};
|
||||
|
||||
if host_addr == libc::MAP_FAILED {
|
||||
error!(
|
||||
"Could not add SGX EPC section (size 0x{:x})",
|
||||
epc_section.size
|
||||
);
|
||||
return Err(Error::SgxEpcRangeAllocation);
|
||||
}
|
||||
|
||||
info!(
|
||||
"Adding SGX EPC section: 0x{:x} (0x{:x})",
|
||||
@@ -2056,7 +2064,7 @@ impl MemoryManager {
|
||||
let _mem_slot = self.create_userspace_mapping(
|
||||
epc_section_start,
|
||||
epc_section.size,
|
||||
host_addr,
|
||||
host_addr as u64,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
|
||||
Reference in New Issue
Block a user