From: "Andreas Färber" <afaerber@suse.de>
To: Mark Langsdorf <mark.langsdorf@calxeda.com>
Cc: Joshua Housh <joshua.housh@calxeda.com>,
aliguori@us.ibm.com, qemu-devel@nongnu.org,
paul@codesourcery.com
Subject: Re: [Qemu-devel] [PATCH 2/2] qdev: fix NULL deference
Date: Tue, 13 Mar 2012 19:55:23 +0100 [thread overview]
Message-ID: <4F5F981B.3010807@suse.de> (raw)
In-Reply-To: <1331663547-30041-1-git-send-email-mark.langsdorf@calxeda.com>
Am 13.03.2012 19:32, schrieb Mark Langsdorf:
> From: Joshua Housh <joshua.housh@calxeda.com>
>
> Make sure a BusInfo exists before trying to dereference it.
What's the use case that breaks?
Andreas
>
> Signed-off-by: Joshua Housh <joshua.housh@calxeda.com>
> Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
> ---
> hw/qdev.c | 9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index ee21d90..6c3d02f 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -86,9 +86,12 @@ void qdev_set_parent_bus(DeviceState *dev, BusState *bus)
> dev->parent_bus = bus;
> QTAILQ_INSERT_HEAD(&bus->children, dev, sibling);
>
> - for (prop = qdev_get_bus_info(dev)->props; prop && prop->name; prop++) {
> - qdev_property_add_legacy(dev, prop, NULL);
> - qdev_property_add_static(dev, prop, NULL);
> + BusInfo *info = qdev_get_bus_info(dev);
> + if (info) {
> + for (prop = info->props; prop && prop->name; prop++) {
> + qdev_property_add_legacy(dev, prop, NULL);
> + qdev_property_add_static(dev, prop, NULL);
> + }
> }
> qdev_prop_set_defaults(dev, dev->parent_bus->info->props);
> }
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2012-03-13 18:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 18:32 [Qemu-devel] [PATCH 2/2] qdev: fix NULL deference Mark Langsdorf
2012-03-13 18:55 ` Andreas Färber [this message]
2012-03-14 7:59 ` Markus Armbruster
2012-03-14 14:30 ` Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F5F981B.3010807@suse.de \
--to=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=joshua.housh@calxeda.com \
--cc=mark.langsdorf@calxeda.com \
--cc=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).