From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VAdO6-0003LU-Og for qemu-devel@nongnu.org; Sat, 17 Aug 2013 06:05:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VAdO0-0004XF-Pp for qemu-devel@nongnu.org; Sat, 17 Aug 2013 06:05:38 -0400 Message-ID: <520F4B7A.1060401@redhat.com> Date: Sat, 17 Aug 2013 12:07:54 +0200 From: Laszlo Ersek MIME-Version: 1.0 References: <1376651630-9151-1-git-send-email-armbru@redhat.com> <1376651630-9151-2-git-send-email-armbru@redhat.com> In-Reply-To: <1376651630-9151-2-git-send-email-armbru@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 1/6] pc: Don't prematurely explode QEMUMachineInitArgs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: armbru@redhat.com Cc: aliguori@us.ibm.com, mjt@tls.msk.ru, qemu-devel@nongnu.org, agraf@suse.de, blauwirbel@gmail.com, qemu-ppc@nongnu.org, aviksil@linux.vnet.ibm.com On 08/16/13 13:13, armbru@redhat.com wrote: > static void pc_init_isa(QEMUMachineInitArgs *args) > { > - ram_addr_t ram_size = args->ram_size; > - const char *cpu_model = args->cpu_model; > - const char *kernel_filename = args->kernel_filename; > - const char *kernel_cmdline = args->kernel_cmdline; > - const char *initrd_filename = args->initrd_filename; > - const char *boot_device = args->boot_device; > has_pci_info = false; > - if (cpu_model == NULL) > - cpu_model = "486"; > + if (!args->cpu_model) { > + args->cpu_model = "486"; > + } This modifies *args. IIUC, args here points to the "args" auto variable in main(). "args.cpu_model" is initialized from the standalone "cpu_model" variable. That one in turn is either NULL, or points to a command line argument. Ie. "args.cpu_model" is never expected to be freed, and the underlying char array is not expected to be modified. OK. Reviewed-by: Laszlo Ersek