From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39346) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPahv-0003eo-MC for qemu-devel@nongnu.org; Thu, 04 Sep 2014 13:20:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPahm-0005Ni-AJ for qemu-devel@nongnu.org; Thu, 04 Sep 2014 13:20:27 -0400 Received: from cantor2.suse.de ([195.135.220.15]:43858 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPahm-0005My-3X for qemu-devel@nongnu.org; Thu, 04 Sep 2014 13:20:18 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 4 Sep 2014 19:20:13 +0200 Message-Id: <1409851213-14330-4-git-send-email-afaerber@suse.de> In-Reply-To: <1409851213-14330-1-git-send-email-afaerber@suse.de> References: <1409851213-14330-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL v2 3/3] target-i386: Reject invalid CPU feature names on the command-line List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Eduardo Habkost , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Eduardo Habkost Instead of simply printing a warning, report an error when invalid CPU options are provided on the CPU model string. Signed-off-by: Eduardo Habkost Reviewed-by: Igor Mammedov Signed-off-by: Andreas F=C3=A4rber --- target-i386/cpu.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 60d0dd5..88b64d8 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -592,7 +592,8 @@ static bool lookup_feature(uint32_t *pval, const char= *s, const char *e, } =20 static void add_flagname_to_bitmaps(const char *flagname, - FeatureWordArray words) + FeatureWordArray words, + Error **errp) { FeatureWord w; for (w =3D 0; w < FEATURE_WORDS; w++) { @@ -603,7 +604,7 @@ static void add_flagname_to_bitmaps(const char *flagn= ame, } } if (w =3D=3D FEATURE_WORDS) { - fprintf(stderr, "CPU feature %s not found\n", flagname); + error_setg(errp, "CPU feature %s not found", flagname); } } =20 @@ -1254,6 +1255,9 @@ void x86_cpu_compat_set_features(const char *cpu_mo= del, FeatureWord w, } } =20 +static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w, + bool migratable_only)= ; + #ifdef CONFIG_KVM =20 static int cpu_x86_fill_model_id(char *str) @@ -1310,9 +1314,6 @@ static void host_x86_cpu_class_init(ObjectClass *oc= , void *data) dc->props =3D host_x86_cpu_properties; } =20 -static uint32_t x86_cpu_get_supported_feature_word(FeatureWord w, - bool migratable_only)= ; - static void host_x86_cpu_initfn(Object *obj) { X86CPU *cpu =3D X86_CPU(obj); @@ -1761,9 +1762,9 @@ static void x86_cpu_parse_featurestr(CPUState *cs, = char *features, while (featurestr) { char *val; if (featurestr[0] =3D=3D '+') { - add_flagname_to_bitmaps(featurestr + 1, plus_features); + add_flagname_to_bitmaps(featurestr + 1, plus_features, &loca= l_err); } else if (featurestr[0] =3D=3D '-') { - add_flagname_to_bitmaps(featurestr + 1, minus_features); + add_flagname_to_bitmaps(featurestr + 1, minus_features, &loc= al_err); } else if ((val =3D strchr(featurestr, '=3D'))) { *val =3D 0; val++; feat2prop(featurestr); --=20 1.8.4.5