From patchwork Mon Mar 18 13:10:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 228621 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 741D02C009C for ; Tue, 19 Mar 2013 00:12:14 +1100 (EST) Received: from localhost ([::1]:49267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHZrH-0003tf-4f for incoming@patchwork.ozlabs.org; Mon, 18 Mar 2013 09:12:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHZqX-0003kR-Da for qemu-devel@nongnu.org; Mon, 18 Mar 2013 09:11:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UHZqR-0000iN-TW for qemu-devel@nongnu.org; Mon, 18 Mar 2013 09:11:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6944) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UHZqR-0000i9-ME for qemu-devel@nongnu.org; Mon, 18 Mar 2013 09:11:19 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2IDBJtA031089 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 18 Mar 2013 09:11:19 -0400 Received: from garlic.tlv.redhat.com (spice-ovirt.tlv.redhat.com [10.35.4.71]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r2IDBCvp032376; Mon, 18 Mar 2013 09:11:18 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Mon, 18 Mar 2013 15:10:48 +0200 Message-Id: <1363612272-13713-3-git-send-email-alevy@redhat.com> In-Reply-To: <1363612272-13713-1-git-send-email-alevy@redhat.com> References: <1363612272-13713-1-git-send-email-alevy@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id r2IDBJtA031089 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: mlureau@redhat.com Subject: [Qemu-devel] [PATCH 02/26] ccid-card-emul: do not crash if backend is not provided 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 From: Marc-André Lureau Program received signal SIGSEGV, Segmentation fault. __strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp-sse42.S:164 164 movdqu (%rsi), %xmm2 (gdb) bt at /home/elmarco/320g/src/qemu/hw/ccid-card-emulated.c:477 at /home/elmarco/320g/src/qemu/hw/ccid-card-emulated.c:503 --- hw/ccid-card-emulated.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/ccid-card-emulated.c b/hw/ccid-card-emulated.c index c8f8ba3..210433e 100644 --- a/hw/ccid-card-emulated.c +++ b/hw/ccid-card-emulated.c @@ -473,6 +473,9 @@ static uint32_t parse_enumeration(char *str, { uint32_t ret = not_found_value; + if (str == NULL) + return 0; + while (table->name != NULL) { if (strcmp(table->name, str) == 0) { ret = table->value;