hv: fix type conversion violations

This patch fixes the following violations:
 1. Implicit conversion: actual to formal param
 2. Value is not of appropriate type
 3. No cast for widening complex int expression
 4. Widening cast on complex integer expression
 5. Narrower int conversion without cast.

Tracked-On: #861
Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
This commit is contained in:
Shiqing Gao
2018-11-30 13:16:14 +08:00
committed by wenlingz
parent a0582c99cf
commit e1564edda5
9 changed files with 16 additions and 16 deletions

View File

@@ -317,7 +317,7 @@ set_expiration(struct acrn_vlapic *vlapic)
if ((tmicr == 0U) || (divisor_shift > 8U)) {
ret = false;
} else {
delta = tmicr << divisor_shift;
delta = (uint64_t)tmicr << divisor_shift;
timer = &vtimer->timer;
if (vlapic_lvtt_period(vlapic)) {
@@ -1163,7 +1163,7 @@ vlapic_get_cr8(const struct acrn_vlapic *vlapic)
uint32_t tpr;
tpr = vlapic_get_tpr(vlapic);
return (uint64_t)(tpr >> 4U);
return ((uint64_t)tpr >> 4UL);
}
static void

View File

@@ -189,7 +189,7 @@ create_rte_for_gsi_irq(uint32_t irq, uint32_t vr)
rte.full |= IOAPIC_RTE_INTAHI;
/* Dest field */
rte.full |= ((uint64_t)ALL_CPUS_MASK << IOAPIC_RTE_DEST_SHIFT);
rte.full |= (ALL_CPUS_MASK << IOAPIC_RTE_DEST_SHIFT);
}
return rte;

View File

@@ -109,7 +109,7 @@ static void create_secure_world_ept(struct acrn_vm *vm, uint64_t gpa_orig,
*/
dest_pdpte_p = pml4e_page_vaddr(sworld_pml4e);
src_pdpte_p = pml4e_page_vaddr(nworld_pml4e);
for (i = 0U; i < (PTRS_PER_PDPTE - 1UL); i++) {
for (i = 0U; i < (uint16_t)(PTRS_PER_PDPTE - 1UL); i++) {
pdpte = get_pgentry(src_pdpte_p);
if ((pdpte & table_present) != 0UL) {
pdpte &= ~EPT_EXE;
@@ -141,7 +141,7 @@ void destroy_secure_world(struct acrn_vm *vm, bool need_clr_mem)
if (need_clr_mem) {
/* clear trusty memory space */
(void)memset(hpa2hva(hpa), 0U, size);
(void)memset(hpa2hva(hpa), 0U, (size_t)size);
}
ept_mr_del(vm, vm->arch_vm.sworld_eptp, gpa_uos, size);
@@ -335,7 +335,7 @@ static bool derive_aek(uint8_t *attkb_key)
max_svn_idx = get_max_svn_index();
ikm = g_key_info.dseed_list[max_svn_idx].seed;
/* only the low 32 bits of seed are valid */
ikm_len = 32;
ikm_len = 32U;
if (hmac_sha256(attkb_key, ikm, ikm_len,
(const uint8_t *)salt, sizeof(salt)) != 1) {

View File

@@ -924,7 +924,7 @@ static void init_exec_ctrl(struct acrn_vcpu *vcpu)
value64 = hva2hpa(vm->arch_vm.io_bitmap);
exec_vmwrite64(VMX_IO_BITMAP_A_FULL, value64);
pr_dbg("VMX_IO_BITMAP_A: 0x%016llx ", value64);
value64 = hva2hpa(&(vm->arch_vm.io_bitmap[CPU_PAGE_SIZE]));
value64 = hva2hpa((void *)&(vm->arch_vm.io_bitmap[CPU_PAGE_SIZE]));
exec_vmwrite64(VMX_IO_BITMAP_B_FULL, value64);
pr_dbg("VMX_IO_BITMAP_B: 0x%016llx ", value64);