From a966ed70c2771a69a411b817714defc3857718d6 Mon Sep 17 00:00:00 2001 From: Victor Sun Date: Mon, 7 Jun 2021 15:59:56 +0800 Subject: [PATCH] HV: correct bootargs module size The bootargs module represents a string buffer and there is a NULL char at the end so its size should not be calculated by strnlen_s(), otherwise the NULL char will be ignored in gpa copy and result in kernel boot fail; Tracked-On: #6162 Signed-off-by: Victor Sun Reviewed-by: Jason Chen CJ --- hypervisor/boot/guest/vboot_info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypervisor/boot/guest/vboot_info.c b/hypervisor/boot/guest/vboot_info.c index 4346e218f..e08211885 100644 --- a/hypervisor/boot/guest/vboot_info.c +++ b/hypervisor/boot/guest/vboot_info.c @@ -150,7 +150,7 @@ static void init_vm_bootargs_info(struct acrn_vm *vm, const struct acrn_boot_inf } - vm->sw.bootargs_info.size = strnlen_s((const char *)vm->sw.bootargs_info.src_addr, MAX_BOOTARGS_SIZE); + vm->sw.bootargs_info.size = strnlen_s((const char *)vm->sw.bootargs_info.src_addr, (MAX_BOOTARGS_SIZE - 1U)) + 1U; }