Skip to contentSkip to conversation

pci: Initialize pci_dev->name before use

PATCH Superseded Alexey Kardashevskiy 2 participants 6 messages Sep 15, 2017 – Oct 15, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 pci: Initialize pci_dev->name before use

This moves pci_dev->name initialization earlier so pci_dev->bus_master_as could get a name instead of an empty string.

---
Changes:
v2:
* fixed mistype in the commit log
* added "rb"

---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
index 21e203b056..353195d154 100644
@@ -1020,6 +1020,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
 
     pci_dev->devfn = devfn;
     pci_dev->requester_id_cache = pci_req_id_cache_get(pci_dev);
+    pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
 
     memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci_dev),
                        "bus master container", UINT64_MAX);
@@ -1029,7 +1030,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
     if (qdev_hotplug) {
         pci_init_bus_master(pci_dev);
     }
-    pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
     pci_dev->irq_state = 0;
     pci_config_alloc(pci_dev);
 
Signature · 1 line
2.11.0
#1 lore raw
Quoted 5 lines · Alexey Kardashevskiy

This moves pci_dev->name initialization earlier so pci_dev->bus_master_as could get a name instead of an empty string.

Ping?

Quoted 30 lines

---
Changes:
v2:
* fixed mistype in the commit log
* added "rb"

---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
index 21e203b056..353195d154 100644
@@ -1020,6 +1020,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
 
     pci_dev->devfn = devfn;
     pci_dev->requester_id_cache = pci_req_id_cache_get(pci_dev);
+    pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
 
     memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci_dev),
                        "bus master container", UINT64_MAX);
@@ -1029,7 +1030,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
     if (qdev_hotplug) {
         pci_init_bus_master(pci_dev);
     }
-    pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
     pci_dev->irq_state = 0;
     pci_config_alloc(pci_dev);
 
Signature · 1 line
Alexey
#2 lore raw
Quoted 8 lines · Alexey Kardashevskiy
Quoted 5 lines · Alexey Kardashevskiy

This moves pci_dev->name initialization earlier so pci_dev->bus_master_as could get a name instead of an empty string.

Ping?

Ping?

Quoted 34 lines
Quoted 32 lines

---
Changes:
v2:
* fixed mistype in the commit log
* added "rb"

---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
index 21e203b056..353195d154 100644
@@ -1020,6 +1020,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
 
     pci_dev->devfn = devfn;
     pci_dev->requester_id_cache = pci_req_id_cache_get(pci_dev);
+    pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
 
     memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci_dev),
                        "bus master container", UINT64_MAX);
@@ -1029,7 +1030,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
     if (qdev_hotplug) {
         pci_init_bus_master(pci_dev);
     }
-    pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
     pci_dev->irq_state = 0;
     pci_config_alloc(pci_dev);
 
Signature · 1 line
Alexey
#3 lore raw
Quoted 11 lines · Alexey Kardashevskiy
Quoted 8 lines · Alexey Kardashevskiy
Quoted 5 lines · Alexey Kardashevskiy

This moves pci_dev->name initialization earlier so pci_dev->bus_master_as could get a name instead of an empty string.

Ping?

Ping?

I can't find v2 in either qemu or my personal mailbox.

Quoted 39 lines
Quoted 35 lines
Quoted 33 lines

---
Changes:
v2:
* fixed mistype in the commit log
* added "rb"

---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
index 21e203b056..353195d154 100644
@@ -1020,6 +1020,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
 
     pci_dev->devfn = devfn;
     pci_dev->requester_id_cache = pci_req_id_cache_get(pci_dev);
+    pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
 
     memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci_dev),
                        "bus master container", UINT64_MAX);
@@ -1029,7 +1030,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
     if (qdev_hotplug) {
         pci_init_bus_master(pci_dev);
     }
-    pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
     pci_dev->irq_state = 0;
     pci_config_alloc(pci_dev);
 
Signature · 1 line
Alexey
#4 lore raw
Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines · Alexey Kardashevskiy
Quoted 4 lines · Alexey Kardashevskiy
Quoted 3 lines · Alexey Kardashevskiy

This moves pci_dev->name initialization earlier so pci_dev->bus_master_as could get a name instead of an empty string.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Ping?

Ping?

I can't find v2 in either qemu or my personal mailbox.

Few weeks ago qemu-devel@ list admins were playing with list-id, may be that's why it missed your inbox.

It hit patchwork though: https://patchwork.ozlabs.org/patch/814085/

Quoted 40 lines
Quoted 40 lines
Quoted 36 lines
Quoted 34 lines

---
Changes:
v2:
* fixed mistype in the commit log
* added "rb"

---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
index 21e203b056..353195d154 100644
@@ -1020,6 +1020,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
 
     pci_dev->devfn = devfn;
     pci_dev->requester_id_cache = pci_req_id_cache_get(pci_dev);
+    pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
 
     memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci_dev),
                        "bus master container", UINT64_MAX);
@@ -1029,7 +1030,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
     if (qdev_hotplug) {
         pci_init_bus_master(pci_dev);
     }
-    pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
     pci_dev->irq_state = 0;
     pci_config_alloc(pci_dev);
 
Signature · 1 line
Alexey
Signature · 1 line
Alexey
#5 lore raw
In reply to Alexey Kardashevskiy
Quoted 11 lines · Alexey Kardashevskiy
Quoted 8 lines · Alexey Kardashevskiy
Quoted 5 lines · Alexey Kardashevskiy

This moves pci_dev->name initialization earlier so pci_dev->bus_master_as could get a name instead of an empty string.

Ping?

Ping?

Pls repost while you CC me. Thanks!

Quoted 39 lines
Quoted 35 lines
Quoted 33 lines

---
Changes:
v2:
* fixed mistype in the commit log
* added "rb"

---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
index 21e203b056..353195d154 100644
@@ -1020,6 +1020,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
 
     pci_dev->devfn = devfn;
     pci_dev->requester_id_cache = pci_req_id_cache_get(pci_dev);
+    pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
 
     memory_region_init(&pci_dev->bus_master_container_region, OBJECT(pci_dev),
                        "bus master container", UINT64_MAX);
@@ -1029,7 +1030,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
     if (qdev_hotplug) {
         pci_init_bus_master(pci_dev);
     }
-    pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
     pci_dev->irq_state = 0;
     pci_config_alloc(pci_dev);
 
Signature · 1 line
Alexey