qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Saravanakumar <saravanakumar.punith@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org,
	Saravanakumar <saravanakumar.punith@gmail.com>,
	mst@redhat.com
Subject: [Qemu-devel] [PATCH] pci: move dereferencing of root only after verifying valid root pointer.
Date: Thu, 22 May 2014 17:03:50 +0530	[thread overview]
Message-ID: <1400758430-32697-1-git-send-email-saravanakumar.punith@gmail.com> (raw)

Move dereferencing of root only after verifying valid root pointer.


Signed-off-by: Saravanakumar <saravanakumar.punith@gmail.com>
---
 hw/pci/pci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 22fe5ee..8d6a8d4 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -605,13 +605,13 @@ PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr)
     int dom, bus;
     unsigned slot;
 
-    assert(!root->parent_dev);
-
     if (!root) {
         fprintf(stderr, "No primary PCI bus\n");
         return NULL;
     }
 
+    assert(!root->parent_dev);
+
     if (!devaddr) {
         *devfnp = -1;
         return pci_find_bus_nr(root, 0);
-- 
1.7.6.5

             reply	other threads:[~2014-05-22 11:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-22 11:33 Saravanakumar [this message]
2014-05-22 12:43 ` [Qemu-devel] [PATCH] pci: move dereferencing of root only after verifying valid root pointer Andreas Färber
2014-05-22 12:47 ` Paolo Bonzini
2014-05-23 20:09 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev

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=1400758430-32697-1-git-send-email-saravanakumar.punith@gmail.com \
    --to=saravanakumar.punith@gmail.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@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).