mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-24 10:17:28 +00:00
hv:fix "missing for discarded return value" for memcpy_s and strcpy_s
It will print error information inside memcpy_s if the parameteter is invalid, the caller can not check the return value for memcpy_s/strcpy_s/strncpy_s code like this: int a(void) { return 0; } int b(void){ a(); } fix as follow: int a(void) { return 0; } int b(void){ (void)a(); } Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
This commit is contained in:
@@ -909,7 +909,7 @@ static void get_entry_info(struct ptdev_remapping_info *entry, char *type,
|
||||
{
|
||||
if (is_entry_active(entry)) {
|
||||
if (entry->type == PTDEV_INTR_MSI) {
|
||||
strcpy_s(type, 16, "MSI");
|
||||
(void)strcpy_s(type, 16, "MSI");
|
||||
*dest = (entry->ptdev_intr_info.msi.pmsi_addr & 0xFF000U)
|
||||
>> 12;
|
||||
if ((entry->ptdev_intr_info.msi.pmsi_data &
|
||||
@@ -928,9 +928,9 @@ static void get_entry_info(struct ptdev_remapping_info *entry, char *type,
|
||||
|
||||
if (entry->ptdev_intr_info.intx.vpin_src
|
||||
== PTDEV_VPIN_IOAPIC)
|
||||
strcpy_s(type, 16, "IOAPIC");
|
||||
(void)strcpy_s(type, 16, "IOAPIC");
|
||||
else
|
||||
strcpy_s(type, 16, "PIC");
|
||||
(void)strcpy_s(type, 16, "PIC");
|
||||
ioapic_get_rte(phys_irq, &rte);
|
||||
*dest = ((rte >> 32) & IOAPIC_RTE_DEST) >> 24;
|
||||
if ((rte & IOAPIC_RTE_TRGRLVL) != 0U)
|
||||
@@ -945,7 +945,7 @@ static void get_entry_info(struct ptdev_remapping_info *entry, char *type,
|
||||
*irq = dev_to_irq(entry->node);
|
||||
*vector = dev_to_vector(entry->node);
|
||||
} else {
|
||||
strcpy_s(type, 16, "NONE");
|
||||
(void)strcpy_s(type, 16, "NONE");
|
||||
*irq = IRQ_INVALID;
|
||||
*vector = 0U;
|
||||
*dest = 0UL;
|
||||
|
@@ -695,7 +695,7 @@ static uint64_t prepare_trampoline(void)
|
||||
pr_dbg("trampoline code: %llx size %x", dest_pa, size);
|
||||
|
||||
/* Copy segment for AP initialization code below 1MB */
|
||||
memcpy_s(HPA2HVA(dest_pa), size, _ld_trampoline_load, size);
|
||||
(void)memcpy_s(HPA2HVA(dest_pa), size, _ld_trampoline_load, size);
|
||||
update_trampoline_code_refs(dest_pa);
|
||||
trampoline_start16_paddr = dest_pa;
|
||||
|
||||
|
@@ -69,7 +69,7 @@ static inline int set_vcpuid_entry(struct vm *vm,
|
||||
}
|
||||
|
||||
tmp = &vm->vcpuid_entries[vm->vcpuid_entry_nr++];
|
||||
memcpy_s(tmp, entry_size, entry, entry_size);
|
||||
(void)memcpy_s(tmp, entry_size, entry, entry_size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@@ -317,9 +317,9 @@ static inline int32_t _copy_gpa(struct vm *vm, void *h_ptr, uint64_t gpa,
|
||||
g_ptr = HPA2HVA(hpa);
|
||||
|
||||
if (cp_from_vm)
|
||||
memcpy_s(h_ptr, len, g_ptr, len);
|
||||
(void)memcpy_s(h_ptr, len, g_ptr, len);
|
||||
else
|
||||
memcpy_s(g_ptr, len, h_ptr, len);
|
||||
(void)memcpy_s(g_ptr, len, h_ptr, len);
|
||||
|
||||
return len;
|
||||
}
|
||||
@@ -825,7 +825,7 @@ uint32_t create_guest_init_gdt(struct vm *vm, uint32_t *limit)
|
||||
void *gtd_addr = GPA2HVA(vm, GUEST_INIT_GDT_START);
|
||||
|
||||
*limit = sizeof(guest_init_gdt) - 1;
|
||||
memcpy_s(gtd_addr, 64, guest_init_gdt, sizeof(guest_init_gdt));
|
||||
(void)memcpy_s(gtd_addr, 64, guest_init_gdt, sizeof(guest_init_gdt));
|
||||
|
||||
return GUEST_INIT_GDT_START;
|
||||
};
|
||||
|
@@ -710,7 +710,7 @@ emulate_movs(struct vcpu *vcpu, __unused uint64_t gpa, struct vie *vie,
|
||||
if ((error != 0) || (fault != 0))
|
||||
goto done;
|
||||
|
||||
memcpy_s((char *)dstaddr, 16U, (char *)srcaddr, opsize);
|
||||
(void)memcpy_s((char *)dstaddr, 16U, (char *)srcaddr, opsize);
|
||||
|
||||
error = vie_read_register(vcpu, CPU_REG_RSI, &rsi);
|
||||
ASSERT(error == 0, "%s: error %d getting rsi", __func__, error);
|
||||
|
@@ -51,7 +51,7 @@ static void vm_setup_cpu_px(struct vm *vm)
|
||||
|
||||
px_data_size = vm->pm.px_cnt * sizeof(struct cpu_px_data);
|
||||
|
||||
memcpy_s(vm->pm.px_data, px_data_size,
|
||||
(void)memcpy_s(vm->pm.px_data, px_data_size,
|
||||
boot_cpu_data.state_info.px_data, px_data_size);
|
||||
|
||||
}
|
||||
@@ -79,7 +79,7 @@ static void vm_setup_cpu_cx(struct vm *vm)
|
||||
/* please note pm.cx_data[0] is a empty space holder,
|
||||
* pm.cx_data[1...MAX_CX_ENTRY] would be used to store cx entry datas.
|
||||
*/
|
||||
memcpy_s(vm->pm.cx_data + 1, cx_data_size,
|
||||
(void)memcpy_s(vm->pm.cx_data + 1, cx_data_size,
|
||||
boot_cpu_data.state_info.cx_data, cx_data_size);
|
||||
|
||||
}
|
||||
|
@@ -122,7 +122,7 @@ int create_vm(struct vm_description *vm_desc, struct vm **rtn_vm)
|
||||
/* populate UOS vm fields according to vm_desc */
|
||||
vm->sworld_control.sworld_enabled =
|
||||
vm_desc->sworld_enabled;
|
||||
memcpy_s(&vm->GUID[0], sizeof(vm->GUID),
|
||||
(void)memcpy_s(&vm->GUID[0], sizeof(vm->GUID),
|
||||
&vm_desc->GUID[0],
|
||||
sizeof(vm_desc->GUID));
|
||||
}
|
||||
|
@@ -283,7 +283,7 @@ OUT:
|
||||
/* we are okay using strcpy_s here even with spinlock
|
||||
* since no #PG in HV right now
|
||||
*/
|
||||
strcpy_s(node->name, 32, info->name);
|
||||
(void)strcpy_s(node->name, 32, info->name);
|
||||
dev_dbg(ACRN_DBG_IRQ, "[%s] %s irq%d vr:0x%x",
|
||||
__func__, node->name, irq, desc->vector);
|
||||
}
|
||||
|
@@ -129,7 +129,7 @@ static void create_secure_world_ept(struct vm *vm, uint64_t gpa_orig,
|
||||
|
||||
|
||||
nworld_pml4e = MEM_READ64(HPA2HVA(vm->arch_vm.nworld_eptp));
|
||||
memcpy_s(HPA2HVA(sworld_pml4e & IA32E_REF_MASK), CPU_PAGE_SIZE,
|
||||
(void)memcpy_s(HPA2HVA(sworld_pml4e & IA32E_REF_MASK), CPU_PAGE_SIZE,
|
||||
HPA2HVA(nworld_pml4e & IA32E_REF_MASK), CPU_PAGE_SIZE);
|
||||
|
||||
/* Map gpa_rebased~gpa_rebased+size
|
||||
@@ -337,7 +337,7 @@ static bool setup_trusty_info(struct vcpu *vcpu,
|
||||
mem = (struct trusty_mem *)(HPA2HVA(mem_base_hpa));
|
||||
|
||||
/* copy key_info to the first page of trusty memory */
|
||||
memcpy_s(&mem->first_page.data.key_info, sizeof(g_key_info),
|
||||
(void)memcpy_s(&mem->first_page.data.key_info, sizeof(g_key_info),
|
||||
&g_key_info, sizeof(g_key_info));
|
||||
|
||||
(void)memset(mem->first_page.data.key_info.dseed_list, 0,
|
||||
@@ -482,7 +482,8 @@ void trusty_set_dseed(void *dseed, uint8_t dseed_num)
|
||||
}
|
||||
|
||||
g_key_info.num_seeds = dseed_num;
|
||||
memcpy_s(&g_key_info.dseed_list, sizeof(struct seed_info) * dseed_num,
|
||||
(void)memcpy_s(&g_key_info.dseed_list,
|
||||
sizeof(struct seed_info) * dseed_num,
|
||||
dseed, sizeof(struct seed_info) * dseed_num);
|
||||
}
|
||||
|
||||
|
@@ -96,7 +96,7 @@ int exec_vmxon_instr(uint16_t pcpu_id)
|
||||
* MSR
|
||||
*/
|
||||
tmp32 = msr_read(MSR_IA32_VMX_BASIC);
|
||||
memcpy_s((uint32_t *) vmxon_region_va, 4, &tmp32, 4);
|
||||
(void)memcpy_s((uint32_t *) vmxon_region_va, 4, &tmp32, 4);
|
||||
|
||||
/* Turn on CR0.NE and CR4.VMXE */
|
||||
CPU_CR_READ(cr0, &tmp64);
|
||||
@@ -1545,7 +1545,7 @@ int init_vmcs(struct vcpu *vcpu)
|
||||
|
||||
/* Obtain the VM Rev ID from HW and populate VMCS page with it */
|
||||
vmx_rev_id = msr_read(MSR_IA32_VMX_BASIC);
|
||||
memcpy_s((void *) vcpu->arch_vcpu.vmcs, 4, &vmx_rev_id, 4);
|
||||
(void)memcpy_s((void *) vcpu->arch_vcpu.vmcs, 4, &vmx_rev_id, 4);
|
||||
|
||||
/* Execute VMCLEAR on current VMCS */
|
||||
vmcs_pa = HVA2HPA(vcpu->arch_vcpu.vmcs);
|
||||
|
Reference in New Issue
Block a user