From patchwork Tue Nov 8 14:36:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 124383 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 52A7FB6F9F for ; Wed, 9 Nov 2011 01:37:05 +1100 (EST) Received: from localhost ([::1]:53973 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNmnN-0003OE-2H for incoming@patchwork.ozlabs.org; Tue, 08 Nov 2011 09:37:01 -0500 Received: from eggs.gnu.org ([140.186.70.92]:49159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNmnG-0003F2-Mb for qemu-devel@nongnu.org; Tue, 08 Nov 2011 09:36:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RNmnF-0006Ws-J9 for qemu-devel@nongnu.org; Tue, 08 Nov 2011 09:36:54 -0500 Received: from oxygen.pond.sub.org ([78.46.104.156]:46459) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RNmnF-0006WR-9e; Tue, 08 Nov 2011 09:36:53 -0500 Received: from blackfin.pond.sub.org (p5B32AA7E.dip.t-dialin.net [91.50.170.126]) by oxygen.pond.sub.org (Postfix) with ESMTPA id 66C25A4111; Tue, 8 Nov 2011 15:36:51 +0100 (CET) Received: by blackfin.pond.sub.org (Postfix, from userid 500) id D51FA60069; Tue, 8 Nov 2011 15:36:50 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 8 Nov 2011 15:36:50 +0100 Message-Id: <1320763010-10024-4-git-send-email-armbru@redhat.com> X-Mailer: git-send-email 1.7.6.4 In-Reply-To: <1320763010-10024-1-git-send-email-armbru@redhat.com> References: <1320763010-10024-1-git-send-email-armbru@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 78.46.104.156 Cc: qemu-trivial@nongnu.org Subject: [Qemu-devel] [PATCH 3/3] x86/cpuid: Fix crash on -cpu "" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Spotted by Coverity. Signed-off-by: Markus Armbruster --- target-i386/cpuid.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target-i386/cpuid.c b/target-i386/cpuid.c index 0fce752..9fc9769 100644 --- a/target-i386/cpuid.c +++ b/target-i386/cpuid.c @@ -613,9 +613,9 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model) uint32_t numvalue; for (def = x86_defs; def; def = def->next) - if (!strcmp(name, def->name)) + if (name && !strcmp(name, def->name)) break; - if (kvm_enabled() && strcmp(name, "host") == 0) { + if (kvm_enabled() && name && strcmp(name, "host") == 0) { cpu_x86_fill_host(x86_cpu_def); } else if (!def) { goto error;