From f010f99d670b5fe231d6ad9829a789ca14624a1f Mon Sep 17 00:00:00 2001 From: Vijay Dhanraj Date: Fri, 17 May 2019 17:12:32 -0700 Subject: [PATCH] DM: Decouple and increase kernel boot args length Currently, we use STR_LEN for all checking the size of all the acrn-dm parameters. But some parameters like kernel boot args can grow based on different needs. For example, when kata launches guest VM using acrn, the kernel boot args increases by 256 bytes (i.e 1024 +256). Just increasing STR_LEN will unnecessarily increase allocations for other acrn-dm parameters. So decoupling only boot_args length and increasing it to 2048. PS: If other parameters like ramdisk path, kernel path, elf_path etc. don't need 1024 bytes, we can reduce STR_LEN to 256 or 512 bytes. Tracked-On: #3138 Signed-off-by: Vijay Dhanraj Acked-by: Anthony Xu --- devicemodel/core/sw_load_common.c | 6 +++--- devicemodel/include/sw_load.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/devicemodel/core/sw_load_common.c b/devicemodel/core/sw_load_common.c index c820f2b3c..0a2a5d7b8 100644 --- a/devicemodel/core/sw_load_common.c +++ b/devicemodel/core/sw_load_common.c @@ -36,7 +36,7 @@ #include "pci_core.h" int with_bootargs; -static char bootargs[STR_LEN]; +static char bootargs[BOOT_ARG_LEN]; /* * Default e820 mem map: @@ -106,9 +106,9 @@ const struct e820_entry e820_default_entries[NUM_E820_ENTRIES] = { int acrn_parse_bootargs(char *arg) { - size_t len = strnlen(arg, STR_LEN); + size_t len = strnlen(arg, BOOT_ARG_LEN); - if (len < STR_LEN) { + if (len < BOOT_ARG_LEN) { strncpy(bootargs, arg, len + 1); with_bootargs = 1; printf("SW_LOAD: get bootargs %s\n", bootargs); diff --git a/devicemodel/include/sw_load.h b/devicemodel/include/sw_load.h index be4b817f8..a19f4bc91 100644 --- a/devicemodel/include/sw_load.h +++ b/devicemodel/include/sw_load.h @@ -29,6 +29,7 @@ #define _CORE_SW_LOAD_ #define STR_LEN 1024 +#define BOOT_ARG_LEN 2048 /* E820 memory types */ #define E820_TYPE_RAM 1 /* EFI 1, 2, 3, 4, 5, 6, 7 */