mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-15 05:49:17 +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:
@@ -45,7 +45,7 @@ void parse_seed_list(struct seed_list_hob *seed_hob)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
memcpy_s(&dseed_list[dseed_index],
|
||||
(void)memcpy_s(&dseed_list[dseed_index],
|
||||
sizeof(struct seed_info),
|
||||
entry->seed,
|
||||
sizeof(struct seed_info));
|
||||
|
@@ -61,12 +61,12 @@ static void parse_other_modules(struct vm *vm,
|
||||
/*copy boot args to load addr, set src=load addr*/
|
||||
if (copy_once != 0) {
|
||||
copy_once = 0;
|
||||
strcpy_s(load_addr, MEM_2K,
|
||||
(void)strcpy_s(load_addr, MEM_2K,
|
||||
vm->sw.linux_info.bootargs_src_addr);
|
||||
vm->sw.linux_info.bootargs_src_addr = load_addr;
|
||||
}
|
||||
|
||||
strcpy_s(load_addr + args_size,
|
||||
(void)strcpy_s(load_addr + args_size,
|
||||
100, dyn_bootargs);
|
||||
vm->sw.linux_info.bootargs_size =
|
||||
strnlen_s(load_addr, MEM_2K);
|
||||
@@ -159,7 +159,7 @@ int init_vm0_boot_info(struct vm *vm)
|
||||
|
||||
cmd_dst = kernel_cmdline;
|
||||
cmd_src = HPA2HVA((uint64_t)mbi->mi_cmdline);
|
||||
strncpy_s(cmd_dst, MEM_2K, cmd_src,
|
||||
(void)strncpy_s(cmd_dst, MEM_2K, cmd_src,
|
||||
strnlen_s(cmd_src, MEM_2K));
|
||||
off = strnlen_s(cmd_dst, MEM_2K);
|
||||
cmd_dst[off] = ' '; /* insert space */
|
||||
@@ -167,7 +167,7 @@ int init_vm0_boot_info(struct vm *vm)
|
||||
|
||||
cmd_dst += off;
|
||||
cmd_src = HPA2HVA((uint64_t)mods[0].mm_string);
|
||||
strncpy_s(cmd_dst, MEM_2K - off, cmd_src,
|
||||
(void)strncpy_s(cmd_dst, MEM_2K - off, cmd_src,
|
||||
strnlen_s(cmd_src, MEM_2K - off));
|
||||
|
||||
vm->sw.linux_info.bootargs_src_addr = kernel_cmdline;
|
||||
|
Reference in New Issue
Block a user