Skip to content

Commit 21b774f

Browse files
kalyazinroypat
authored andcommitted
fix(vmm): simplify vcpus_handles dereferencing in process_uffd_socket
Get rid of the expect by using indexing. Signed-off-by: Nikita Kalyazin <[email protected]>
1 parent 96da6f0 commit 21b774f

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/vmm/src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ use crate::vmm_config::instance_info::InstanceInfo;
5757
use crate::vmm_config::machine_config::MachineConfigError;
5858
use crate::vmm_config::snapshot::{LoadSnapshotParams, MemBackendType};
5959
use crate::vstate::kvm::{Kvm, KvmError};
60-
use crate::vstate::memory::{MaybeBounce, create_memfd, MemoryError};
60+
use crate::vstate::memory::{MaybeBounce, MemoryError, create_memfd};
6161
#[cfg(target_arch = "aarch64")]
6262
use crate::vstate::resources::ResourceAllocator;
6363
use crate::vstate::vcpu::VcpuError;

src/vmm/src/lib.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -701,11 +701,7 @@ impl Vmm {
701701
match result {
702702
Ok(fault_reply) => {
703703
let vcpu = fault_reply.vcpu.expect("vCPU must be set");
704-
705-
self.vcpus_handles
706-
.get(vcpu as usize)
707-
.expect("Invalid vcpu index")
708-
.send_userfault_resolved();
704+
self.vcpus_handles[vcpu as usize].send_userfault_resolved();
709705

710706
total_consumed = parser.byte_offset();
711707
}

0 commit comments

Comments
 (0)