From b2c2ca2ecd20cf4b2ebf81fbbb47981518e2e4b9 Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Mon, 21 May 2018 23:31:23 +0800 Subject: [PATCH] hv: not necessary to deal with '\n' of cmdline in ACRN. We removed '\n' in bootargs file so there is no '\n' attached to cmdline when stitching ACRN. Then we don't need to deal with it in ACRN. Signed-off-by: Yin Fengwei Acked-by: Eddie Dong --- hypervisor/boot/sbl/multiboot.c | 2 +- hypervisor/common/vm_load.c | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/hypervisor/boot/sbl/multiboot.c b/hypervisor/boot/sbl/multiboot.c index afa1990f3..378611b34 100644 --- a/hypervisor/boot/sbl/multiboot.c +++ b/hypervisor/boot/sbl/multiboot.c @@ -95,7 +95,7 @@ static void parse_other_modules(struct vm *vm, vm->sw.linux_info.bootargs_src_addr = load_addr; } - strcpy_s(load_addr + args_size - 1, + strcpy_s(load_addr + args_size, 100, dyn_bootargs); vm->sw.linux_info.bootargs_size = strnlen_s(load_addr, MEM_2K); diff --git a/hypervisor/common/vm_load.c b/hypervisor/common/vm_load.c index af4512c8c..e148f9a42 100644 --- a/hypervisor/common/vm_load.c +++ b/hypervisor/common/vm_load.c @@ -190,12 +190,11 @@ int general_sw_loader(struct vm *vm, struct vcpu *vcpu) #ifdef CONFIG_CMA /* add "cma=XXXXM@0xXXXXXXXX" to cmdline*/ if (is_vm0(vm) && (e820_mem.max_ram_blk_size > 0)) { - snprintf(dyn_bootargs, 100, " cma=%dM@0x%llx\n", + snprintf(dyn_bootargs, 100, " cma=%dM@0x%llx", (e820_mem.max_ram_blk_size >> 20), e820_mem.max_ram_blk_base); - /* Delete '\n' at the end of cmdline */ strcpy_s((char *)hva - +vm->sw.linux_info.bootargs_size - 1, + +vm->sw.linux_info.bootargs_size, 100, dyn_bootargs); } #else @@ -215,11 +214,10 @@ int general_sw_loader(struct vm *vm, struct vcpu *vcpu) #endif if (reserving_1g_pages > 0) { snprintf(dyn_bootargs, 100, - " hugepagesz=1G hugepages=%d\n", + " hugepagesz=1G hugepages=%d", reserving_1g_pages); - /* Delete '\n' at the end of cmdline */ strcpy_s((char *)hva - +vm->sw.linux_info.bootargs_size - 1, + +vm->sw.linux_info.bootargs_size, 100, dyn_bootargs); } }