mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-07-28 22:18:04 +00:00
HV: fix violations touched type conversion
ACRN Coding guidelines requires type conversion shall be explicity. Tracked-On: #861 Signed-off-by: Huihuang Shi <huihuang.shi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
5d6c9c33ca
commit
714162fb8b
@ -105,10 +105,10 @@ int32_t mptable_build(struct acrn_vm *vm)
|
||||
(const void *)&mptable_template, sizeof(struct mptable_info));
|
||||
|
||||
mptable->mpch.entry_count = vcpu_num + MPE_NUM_BUSES + MPEII_NUM_LOCAL_IRQ;
|
||||
mptable->mpch.base_table_length = sizeof(struct mpcth)
|
||||
+ vcpu_num * sizeof(struct proc_entry)
|
||||
+ MPE_NUM_BUSES * sizeof(struct bus_entry)
|
||||
+ MPEII_NUM_LOCAL_IRQ * sizeof(struct int_entry);
|
||||
mptable->mpch.base_table_length = (uint16_t)sizeof(struct mpcth)
|
||||
+ vcpu_num * (uint16_t)sizeof(struct proc_entry)
|
||||
+ MPE_NUM_BUSES * (uint16_t)sizeof(struct bus_entry)
|
||||
+ MPEII_NUM_LOCAL_IRQ * (uint16_t)sizeof(struct int_entry);
|
||||
|
||||
mptable_length = sizeof(struct mpfps) + mptable->mpch.base_table_length;
|
||||
if (mptable_length <= MPTABLE_MAX_LENGTH) {
|
||||
|
@ -349,9 +349,9 @@ static bool setup_trusty_info(struct acrn_vcpu *vcpu, uint32_t mem_size, uint64_
|
||||
|
||||
stac();
|
||||
mem = (struct trusty_mem *)(hpa2hva(mem_base_hpa));
|
||||
(void)memcpy_s(&mem->first_page.key_info, sizeof(struct trusty_key_info),
|
||||
(void)memcpy_s((void *)&mem->first_page.key_info, sizeof(struct trusty_key_info),
|
||||
&key_info, sizeof(key_info));
|
||||
(void)memcpy_s(&mem->first_page.startup_param, sizeof(struct trusty_startup_param),
|
||||
(void)memcpy_s((void *)&mem->first_page.startup_param, sizeof(struct trusty_startup_param),
|
||||
&startup_param, sizeof(startup_param));
|
||||
clac();
|
||||
success = true;
|
||||
|
@ -210,8 +210,8 @@ static int32_t set_vcpuid_sgx(struct acrn_vm *vm)
|
||||
if (result == 0) {
|
||||
init_vcpuid_entry(CPUID_SGX_LEAF, 1U, CPUID_CHECK_SUBLEAF, &entry);
|
||||
/* MPX not present to guest */
|
||||
entry.ecx &= ~XCR0_BNDREGS;
|
||||
entry.ecx &= ~XCR0_BNDCSR;
|
||||
entry.ecx &= (uint32_t) ~XCR0_BNDREGS;
|
||||
entry.ecx &= (uint32_t) ~XCR0_BNDCSR;
|
||||
result = set_vcpuid_entry(vm, &entry);
|
||||
}
|
||||
if (result == 0) {
|
||||
|
@ -225,7 +225,7 @@ create_rte_for_gsi_irq(uint32_t irq, uint32_t vr)
|
||||
rte.bits.intr_polarity = IOAPIC_RTE_INTPOL_AHI;
|
||||
|
||||
/* Dest field */
|
||||
rte.bits.dest_field = ALL_CPUS_MASK;
|
||||
rte.bits.dest_field = (uint8_t) ALL_CPUS_MASK;
|
||||
}
|
||||
|
||||
return rte;
|
||||
|
@ -71,7 +71,7 @@ static uint32_t parse_seed_arg(void)
|
||||
arg -= len;
|
||||
len = (arg_end != NULL) ? (uint32_t)(arg_end - arg) :
|
||||
strnlen_s(arg, MAX_BOOTARGS_SIZE);
|
||||
(void)memset((void *)arg, (char)' ', len);
|
||||
(void)memset((void *)arg, (uint8_t)' ', len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ int32_t parse_hv_cmdline(void)
|
||||
while ((*end != ' ') && ((*end) != '\0'))
|
||||
end++;
|
||||
|
||||
if (!handle_dbg_cmd(start, end - start)) {
|
||||
if (!handle_dbg_cmd(start, (int32_t)(end - start))) {
|
||||
/* if not handled by handle_dbg_cmd, it can be handled further */
|
||||
}
|
||||
start = end + 1;
|
||||
|
@ -299,7 +299,7 @@ static int32_t depri_boot_sw_loader(struct acrn_vm *vm)
|
||||
* We copy the info saved in depri_boot to boot_context and
|
||||
* init bsp with boot_context.
|
||||
*/
|
||||
(void)memcpy_s(&(vcpu_regs->gprs), sizeof(struct acrn_gp_regs),
|
||||
(void)memcpy_s((void *)&(vcpu_regs->gprs), sizeof(struct acrn_gp_regs),
|
||||
&(depri_boot_ctx->vcpu_regs.gprs), sizeof(struct acrn_gp_regs));
|
||||
|
||||
vcpu_regs->rip = depri_boot_ctx->vcpu_regs.rip;
|
||||
|
@ -79,10 +79,11 @@ static void vuart_console_rx_chars(struct acrn_vuart *vu)
|
||||
*/
|
||||
static void vuart_console_tx_chars(struct acrn_vuart *vu)
|
||||
{
|
||||
char c;
|
||||
char c = vuart_getchar(vu);
|
||||
|
||||
while ((c = vuart_getchar(vu)) != -1) {
|
||||
while(c != -1) {
|
||||
printf("%c", c);
|
||||
c = vuart_getchar(vu);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1382,7 +1382,7 @@ void profiling_pre_vmexit_handler(struct acrn_vcpu *vcpu)
|
||||
get_cpu_var(profiling_info.vm_info).guest_cs
|
||||
= exec_vmread64(VMX_GUEST_CS_SEL);
|
||||
|
||||
get_cpu_var(profiling_info.vm_info).guest_vm_id = (int32_t)vcpu->vm->vm_id;
|
||||
get_cpu_var(profiling_info.vm_info).guest_vm_id = (int16_t)vcpu->vm->vm_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -876,8 +876,8 @@ static int32_t shell_to_vm_console(int32_t argc, char **argv)
|
||||
struct acrn_vm *vm;
|
||||
struct acrn_vuart *vu;
|
||||
|
||||
if (argc == 2U) {
|
||||
vm_id = sanitize_vmid(strtol_deci(argv[1]));
|
||||
if (argc == 2) {
|
||||
vm_id = sanitize_vmid((uint16_t)strtol_deci(argv[1]));
|
||||
}
|
||||
|
||||
/* Get the virtual device node */
|
||||
|
@ -29,7 +29,7 @@ static bool cmos_update_in_progress(void)
|
||||
static uint8_t cmos_get_reg_val(uint8_t addr)
|
||||
{
|
||||
uint8_t reg;
|
||||
int32_t tries = 2000U;
|
||||
int32_t tries = 2000;
|
||||
|
||||
spinlock_obtain(&cmos_lock);
|
||||
|
||||
|
@ -198,7 +198,7 @@ union ioapic_rte {
|
||||
uint32_t hi_32;
|
||||
} u;
|
||||
struct {
|
||||
uint64_t vector:8;
|
||||
uint8_t vector:8;
|
||||
uint64_t delivery_mode:3;
|
||||
uint64_t dest_mode:1;
|
||||
uint64_t delivery_status:1;
|
||||
@ -207,7 +207,7 @@ union ioapic_rte {
|
||||
uint64_t trigger_mode:1;
|
||||
uint64_t intr_mask:1;
|
||||
uint64_t rsvd_1:39;
|
||||
uint64_t dest_field:8;
|
||||
uint8_t dest_field:8;
|
||||
} bits __packed;
|
||||
struct {
|
||||
uint32_t vector:8;
|
||||
|
@ -82,7 +82,7 @@
|
||||
|
||||
/* MP Floating Pointer Structure */
|
||||
struct mpfps {
|
||||
uint8_t signature[4];
|
||||
char signature[4];
|
||||
uint32_t pap;
|
||||
uint8_t length;
|
||||
uint8_t spec_rev;
|
||||
@ -96,12 +96,12 @@ struct mpfps {
|
||||
|
||||
/* MP Configuration Table Header */
|
||||
struct mpcth {
|
||||
uint8_t signature[4];
|
||||
char signature[4];
|
||||
uint16_t base_table_length;
|
||||
uint8_t spec_rev;
|
||||
uint8_t checksum;
|
||||
uint8_t oem_id[8];
|
||||
uint8_t product_id[12];
|
||||
char oem_id[8];
|
||||
char product_id[12];
|
||||
uint32_t oem_table_pointer;
|
||||
uint16_t oem_table_size;
|
||||
uint16_t entry_count;
|
||||
@ -125,7 +125,7 @@ struct proc_entry {
|
||||
struct bus_entry {
|
||||
uint8_t type;
|
||||
uint8_t bus_id;
|
||||
uint8_t bus_type[6];
|
||||
char bus_type[6];
|
||||
} __packed;
|
||||
|
||||
struct int_entry {
|
||||
|
Loading…
Reference in New Issue
Block a user