mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-26 23:38:31 +00:00
dragonball: Fix unnecessary_cast warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been raised due to unnecessary_cast. Let's fix them all here. For more info about the warnings, please, take a look at: https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
parent
a545a65934
commit
0b2f060bf3
@ -401,9 +401,9 @@ impl AddressSpaceMgr {
|
||||
let flags = 0u32;
|
||||
|
||||
let mem_region = kvm_userspace_memory_region {
|
||||
slot: slot as u32,
|
||||
slot,
|
||||
guest_phys_addr: reg.start_addr().raw_value(),
|
||||
memory_size: reg.len() as u64,
|
||||
memory_size: reg.len(),
|
||||
userspace_addr: host_addr as u64,
|
||||
flags,
|
||||
};
|
||||
@ -421,7 +421,7 @@ impl AddressSpaceMgr {
|
||||
self.base_to_slot
|
||||
.lock()
|
||||
.unwrap()
|
||||
.insert(reg.start_addr().raw_value(), slot as u32);
|
||||
.insert(reg.start_addr().raw_value(), slot);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -435,10 +435,7 @@ impl ResourceManager {
|
||||
constraint.max = r.1 as u64;
|
||||
}
|
||||
match self.allocate_pio_address(&constraint) {
|
||||
Some(base) => Resource::PioAddressRange {
|
||||
base: base as u16,
|
||||
size: *size,
|
||||
},
|
||||
Some(base) => Resource::PioAddressRange { base, size: *size },
|
||||
None => {
|
||||
if let Err(e) = self.free_device_resources(&resources) {
|
||||
return Err(e);
|
||||
|
@ -41,7 +41,7 @@ extern "C" fn sigsys_handler(num: c_int, info: *mut siginfo_t, _unused: *mut c_v
|
||||
let si_code = unsafe { (*info).si_code };
|
||||
|
||||
// Sanity check. The condition should never be true.
|
||||
if num != si_signo || num != SIGSYS || si_code != SYS_SECCOMP_CODE as i32 {
|
||||
if num != si_signo || num != SIGSYS || si_code != SYS_SECCOMP_CODE {
|
||||
// Safe because we're terminating the process anyway.
|
||||
unsafe { _exit(i32::from(super::EXIT_CODE_UNEXPECTED_ERROR)) };
|
||||
}
|
||||
|
@ -96,14 +96,14 @@ impl Vcpu {
|
||||
if let Some(start_addr) = kernel_start_addr {
|
||||
dbs_arch::regs::setup_regs(
|
||||
&self.fd,
|
||||
start_addr.raw_value() as u64,
|
||||
start_addr.raw_value(),
|
||||
dbs_boot::layout::BOOT_STACK_POINTER,
|
||||
dbs_boot::layout::BOOT_STACK_POINTER,
|
||||
dbs_boot::layout::ZERO_PAGE_START,
|
||||
)
|
||||
.map_err(VcpuError::REGSConfiguration)?;
|
||||
dbs_arch::regs::setup_fpu(&self.fd).map_err(VcpuError::FPUConfiguration)?;
|
||||
let gdt_table: [u64; dbs_boot::layout::BOOT_GDT_MAX as usize] = [
|
||||
let gdt_table: [u64; dbs_boot::layout::BOOT_GDT_MAX] = [
|
||||
gdt_entry(0, 0, 0), // NULL
|
||||
gdt_entry(0xa09b, 0, 0xfffff), // CODE
|
||||
gdt_entry(0xc093, 0, 0xfffff), // DATA
|
||||
@ -129,7 +129,7 @@ impl Vcpu {
|
||||
fn set_cpuid(&mut self, vcpu_config: &VcpuConfig) -> Result<()> {
|
||||
let cpuid_vm_spec = VmSpec::new(
|
||||
self.id,
|
||||
vcpu_config.max_vcpu_count as u8,
|
||||
vcpu_config.max_vcpu_count,
|
||||
vcpu_config.threads_per_core,
|
||||
vcpu_config.cores_per_die,
|
||||
vcpu_config.dies_per_socket,
|
||||
|
@ -81,10 +81,10 @@ fn configure_system<M: GuestMemory>(
|
||||
if mem_end < mmio_start {
|
||||
add_e820_entry(
|
||||
&mut params.0,
|
||||
himem_start.raw_value() as u64,
|
||||
himem_start.raw_value(),
|
||||
// it's safe to use unchecked_offset_from because
|
||||
// mem_end > himem_start
|
||||
mem_end.unchecked_offset_from(himem_start) as u64 + 1,
|
||||
mem_end.unchecked_offset_from(himem_start) + 1,
|
||||
bootparam::E820_RAM,
|
||||
)
|
||||
.map_err(Error::BootSystem)?;
|
||||
@ -103,7 +103,7 @@ fn configure_system<M: GuestMemory>(
|
||||
&mut params.0,
|
||||
mmio_end.raw_value() + 1,
|
||||
// it's safe to use unchecked_offset_from because mem_end > mmio_end
|
||||
mem_end.unchecked_offset_from(mmio_end) as u64,
|
||||
mem_end.unchecked_offset_from(mmio_end),
|
||||
bootparam::E820_RAM,
|
||||
)
|
||||
.map_err(Error::BootSystem)?;
|
||||
|
Loading…
Reference in New Issue
Block a user