File tree Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Expand file tree Collapse file tree 3 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -297,9 +297,11 @@ mod tests {
297
297
// This value should be saved in the address provided to the ioctl.
298
298
let mut data: u32 = 0 ;
299
299
300
- let mut gic_attr = kvm_bindings:: kvm_device_attr:: default ( ) ;
301
- gic_attr. group = KVM_DEV_ARM_VGIC_GRP_NR_IRQS ;
302
- gic_attr. addr = data as u64 ;
300
+ let mut gic_attr = kvm_bindings:: kvm_device_attr {
301
+ group : KVM_DEV_ARM_VGIC_GRP_NR_IRQS ,
302
+ addr : data as u64 ,
303
+ ..Default :: default ( )
304
+ } ;
303
305
304
306
// Without properly providing the address to where the
305
307
// value will be stored, the ioctl fails with EFAULT.
Original file line number Diff line number Diff line change @@ -1780,7 +1780,7 @@ mod tests {
1780
1780
// Get a mutable slice of `mem_size` from `load_addr`.
1781
1781
// This is safe because we mapped it before.
1782
1782
let mut slice = std:: slice:: from_raw_parts_mut ( load_addr, mem_size) ;
1783
- slice. write ( & code) . unwrap ( ) ;
1783
+ slice. write_all ( & code) . unwrap ( ) ;
1784
1784
}
1785
1785
1786
1786
let vcpu_fd = vm. create_vcpu ( 0 ) . unwrap ( ) ;
@@ -1825,10 +1825,10 @@ mod tests {
1825
1825
// The code snippet dirties one page at guest_addr + 0x10000.
1826
1826
// The code page should not be dirty, as it's not written by the guest.
1827
1827
let dirty_pages_bitmap = vm. get_dirty_log ( slot, mem_size) . unwrap ( ) ;
1828
- let dirty_pages = dirty_pages_bitmap
1828
+ let dirty_pages: u32 = dirty_pages_bitmap
1829
1829
. into_iter ( )
1830
1830
. map ( |page| page. count_ones ( ) )
1831
- . fold ( 0 , |dirty_page_count , i| dirty_page_count + i ) ;
1831
+ . sum ( ) ;
1832
1832
assert_eq ! ( dirty_pages, 1 ) ;
1833
1833
}
1834
1834
VcpuExit :: SystemEvent ( type_, flags) => {
Original file line number Diff line number Diff line change @@ -1291,15 +1291,14 @@ pub(crate) fn create_gic_device(vm: &VmFd, flags: u32) -> DeviceFd {
1291
1291
fd : 0 ,
1292
1292
flags,
1293
1293
} ;
1294
- let device_fd = match vm. create_device ( & mut gic_device) {
1294
+ match vm. create_device ( & mut gic_device) {
1295
1295
Ok ( fd) => fd,
1296
1296
Err ( _) => {
1297
1297
gic_device. type_ = kvm_device_type_KVM_DEV_TYPE_ARM_VGIC_V2;
1298
1298
vm. create_device ( & mut gic_device)
1299
1299
. expect ( "Cannot create KVM vGIC device" )
1300
1300
}
1301
- } ;
1302
- device_fd
1301
+ }
1303
1302
}
1304
1303
1305
1304
/// Set supported number of IRQs for vGIC.
You can’t perform that action at this time.
0 commit comments