From patchwork Wed Sep 16 20:25:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 33736 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6E272B7B69 for ; Thu, 17 Sep 2009 06:40:07 +1000 (EST) Received: from localhost ([127.0.0.1]:45904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mo1IK-0002t0-D0 for incoming@patchwork.ozlabs.org; Wed, 16 Sep 2009 16:40:04 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mo14c-0006p2-Bq for qemu-devel@nongnu.org; Wed, 16 Sep 2009 16:25:54 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mo14X-0006lp-A5 for qemu-devel@nongnu.org; Wed, 16 Sep 2009 16:25:53 -0400 Received: from [199.232.76.173] (port=60817 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mo14W-0006lT-9b for qemu-devel@nongnu.org; Wed, 16 Sep 2009 16:25:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42752) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mo14V-0001TU-Ri for qemu-devel@nongnu.org; Wed, 16 Sep 2009 16:25:48 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8GKPl92028824 for ; Wed, 16 Sep 2009 16:25:47 -0400 Received: from zweiblum.home.kraxel.org (vpn2-9-132.ams2.redhat.com [10.36.9.132]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with SMTP id n8GKPiYE017206; Wed, 16 Sep 2009 16:25:45 -0400 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id 3618A700E2; Wed, 16 Sep 2009 22:25:44 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Wed, 16 Sep 2009 22:25:42 +0200 Message-Id: <1253132744-10492-4-git-send-email-kraxel@redhat.com> In-Reply-To: <1253132744-10492-1-git-send-email-kraxel@redhat.com> References: <1253132744-10492-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 3/5] qdev: don't crash on unset drive properties. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Gerd Hoffmann --- hw/qdev-properties.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index 2ecb58d..edacf35 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -180,7 +180,7 @@ static int parse_drive(DeviceState *dev, Property *prop, const char *str) static int print_drive(DeviceState *dev, Property *prop, char *dest, size_t len) { DriveInfo **ptr = qdev_get_prop_ptr(dev, prop); - return snprintf(dest, len, "%s", (*ptr)->id); + return snprintf(dest, len, "%s", (*ptr) ? (*ptr)->id : ""); } PropertyInfo qdev_prop_drive = {