Received: from eggs.gnu.org ([208.118.235.92]:48174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAie9-0008Gj-9d for qemu-devel@nongnu.org; Thu, 22 Mar 2012 10:05:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SAie2-0001iV-Vp for qemu-devel@nongnu.org; Thu, 22 Mar 2012 10:05:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33082) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SAie2-0001iE-Ne for qemu-devel@nongnu.org; Thu, 22 Mar 2012 10:05:38 -0400 Date: Thu, 22 Mar 2012 11:05:15 -0300 From: Eduardo Habkost Message-ID: <20120322140515.GX9375@otherpad.lan.raisama.net> References: <1332333220-31420-1-git-send-email-ehabkost@redhat.com> <4F6B28F0.9060301@linux.vnet.ibm.com> <4F6B2D48.6090400@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <4F6B2D48.6090400@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] fix '-cpu ?' Segfault List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: Stefan Hajnoczi , qemu-devel@nongnu.org, Stefan Berger On Thu, Mar 22, 2012 at 02:46:48PM +0100, Andreas F=E4rber wrote: > Am 22.03.2012 14:28, schrieb Stefan Berger: > > On 03/21/2012 08:33 AM, Eduardo Habkost wrote: > >> Fix stupid copy&paste mistake at commit > >> ecf40beae7dcbb057d4f115207f9d8276832a774: I moved code around but ke= pt > >> "optarg" on the cpu_list() call. > >> > >> Reported-by: Jiri Denemark > >> Signed-off-by: Eduardo Habkost > >> --- > >> vl.c | 2 +- > >> 1 files changed, 1 insertions(+), 1 deletions(-) > >> > >> diff --git a/vl.c b/vl.c > >> index 112b0e0..0fccf50 100644 > >> --- a/vl.c > >> +++ b/vl.c > >> @@ -3196,7 +3196,7 @@ int main(int argc, char **argv, char **envp) > >> cpudef_init(); > >> > >> if (cpu_model&& *cpu_model =3D=3D '?') { > >> - list_cpus(stdout,&fprintf, optarg); > >> + list_cpus(stdout,&fprintf, cpu_model); > >> exit(0); > >> } > >> > > Does -cpu ? actually work then? I only see the list of cpus when usin= g > > -cpu ?_ for example. >=20 > You're right, it should be cpu_model + 1 from what I recall, i.e. just > the optional argument, not the whole model string. No, list_cpus() expects the whole argument string, including the leading = "?": void list_cpus(FILE *f, fprintf_function cpu_fprintf, const char *optarg) { /* XXX: implement xxx_cpu_list for targets that still miss it */ #if defined(cpu_list_id) cpu_list_id(f, cpu_fprintf, optarg); #elif defined(cpu_list) cpu_list(f, cpu_fprintf); /* deprecated */ #endif } [...] #define cpu_list_id x86_cpu_list [...] void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf, const char *opta= rg) { unsigned char model =3D !strcmp("?model", optarg); unsigned char dump =3D !strcmp("?dump", optarg); unsigned char cpuid =3D !strcmp("?cpuid", optarg); [...] --=20 Eduardo