On Wed, 03/09 14:14, Peter Xu wrote: > Use heap rather than stack for kcmdline. > > Signed-off-by: Peter Xu <pet...@redhat.com> > --- > hw/i386/multiboot.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c > index 9e164e6..bc45394 100644 > --- a/hw/i386/multiboot.c > +++ b/hw/i386/multiboot.c > @@ -324,10 +324,9 @@ int load_multiboot(FWCfgState *fw_cfg, > } > > /* Commandline support */ > - char kcmdline[strlen(kernel_filename) + strlen(kernel_cmdline) + 2]; > - snprintf(kcmdline, sizeof(kcmdline), "%s %s", > - kernel_filename, kernel_cmdline); > + char *kcmdline = g_strdup_printf("%s %s", kernel_filename, > kernel_cmdline); > stl_p(bootinfo + MBI_CMDLINE, mb_add_cmdline(&mbs, kcmdline)); > + g_free(kcmdline); > > stl_p(bootinfo + MBI_BOOTLOADER, mb_add_bootloader(&mbs, > bootloader_name));
While at it, it's better to move the variable declaration to the beginning of function. Fam