Skip to contentSkip to conversation

pci: move dereferencing of root only after verifying valid root pointer.

PATCH Applied Saravanakumar 4 participants 4 messages May 22, 2014 – May 23, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci: move dereferencing of root only after verifying valid root pointer.

Move dereferencing of root only after verifying valid root pointer.

---
 hw/pci/pci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/pci/pci.c +2 -2
index 22fe5ee..8d6a8d4 100644
@@ -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);
Signature · 1 line
1.7.6.5
Reviewed-by on v1 1/1
#1 lore raw

Am 22.05.2014 13:33, schrieb Saravanakumar:

Quoted 4 lines

Move dereferencing of root only after verifying valid root pointer.

Looks sensible, but mst can hopefully tweak the overly long subject. No need to write the same into subject and body. That said,

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Reviewed-by on v1 1/1
#2 lore raw
In reply to Saravanakumar

Il 22/05/2014 13:33, Saravanakumar ha scritto:

Quoted 19 lines

Move dereferencing of root only after verifying valid root pointer.

---
 hw/pci/pci.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/pci/pci.c +0 -2
index 22fe5ee..8d6a8d4 100644
@@ -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);
-

hw/pci/pci.c PCIBus *pci_get_bus_devfn(int *devfnp, PCIBus *root, const char *devaddr) · line 617

Quoted 10 lines
hw/pci/pci.c +2 -0
     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);
#3 lore raw
In reply to Saravanakumar
Quoted 1 line · Saravanakumar

Move dereferencing of root only after verifying valid root pointer.

Applied to -trivial, after removing duplicate commit comment. Thank you!

/mjt