All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus
       [not found] <20100824062517.12408.45246.stgit@k1>
@ 2010-08-24  6:33   ` Ken CC
  2010-08-24  6:34   ` [Qemu-devel] " Ken CC
  1 sibling, 0 replies; 7+ messages in thread
From: Ken CC @ 2010-08-24  6:33 UTC (permalink / raw)
  To: kvm; +Cc: yamahata, qemu-devel

assert(devfn < PCIBUS_MAX_DEVICES)

Signed-off-by: Ken CC <ken.ccao@gmail.com>
---
 hw/pci.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 02019a1..1e804da 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -747,6 +747,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
                                          PCIConfigWriteFunc *config_write,
                                          bool is_bridge)
 {
+    assert(devfn < PCIBUS_MAX_DEVICES);
     if (devfn < 0) {
         for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
             devfn += PCI_FUNC_MAX) {


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH 2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus
@ 2010-08-24  6:33   ` Ken CC
  0 siblings, 0 replies; 7+ messages in thread
From: Ken CC @ 2010-08-24  6:33 UTC (permalink / raw)
  To: kvm; +Cc: yamahata, qemu-devel

assert(devfn < PCIBUS_MAX_DEVICES)

Signed-off-by: Ken CC <ken.ccao@gmail.com>
---
 hw/pci.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 02019a1..1e804da 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -747,6 +747,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
                                          PCIConfigWriteFunc *config_write,
                                          bool is_bridge)
 {
+    assert(devfn < PCIBUS_MAX_DEVICES);
     if (devfn < 0) {
         for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
             devfn += PCI_FUNC_MAX) {

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/3] Check pci slot number in parse_pci_devfn
       [not found] <20100824062517.12408.45246.stgit@k1>
@ 2010-08-24  6:34   ` Ken CC
  2010-08-24  6:34   ` [Qemu-devel] " Ken CC
  1 sibling, 0 replies; 7+ messages in thread
From: Ken CC @ 2010-08-24  6:34 UTC (permalink / raw)
  To: kvm; +Cc: yamahata, qemu-devel

Define MAX_PCI_SLOTS as 0x1f, if pci addr provided from command line
is bigger than 0x1f, return error -EINVAL.

0x1f << 3 | 7 == 255 (PCIBUS_MAX_DEVICES - 1)

Signed-off-by: Ken CC <ken.ccao@gmail.com>
---
 hw/qdev-properties.c |    2 ++
 hw/qdev.h            |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 9219cd7..96d814c 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -514,6 +514,8 @@ static int parse_pci_devfn(DeviceState *dev, Property *prop, const char *str)
             return -EINVAL;
         }
     }
+    if (slot > MAX_PCI_SLOTS)
+        return -EINVAL;
     if (str[n] != '\0')
         return -EINVAL;
     if (fn > 7)
diff --git a/hw/qdev.h b/hw/qdev.h
index 678f8b7..fcfe52e 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -7,6 +7,9 @@
 #include "qemu-char.h"
 #include "qemu-option.h"
 
+
+#define MAX_PCI_SLOTS 0x1f
+
 typedef struct Property Property;
 
 typedef struct PropertyInfo PropertyInfo;


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH 3/3] Check pci slot number in parse_pci_devfn
@ 2010-08-24  6:34   ` Ken CC
  0 siblings, 0 replies; 7+ messages in thread
From: Ken CC @ 2010-08-24  6:34 UTC (permalink / raw)
  To: kvm; +Cc: yamahata, qemu-devel

Define MAX_PCI_SLOTS as 0x1f, if pci addr provided from command line
is bigger than 0x1f, return error -EINVAL.

0x1f << 3 | 7 == 255 (PCIBUS_MAX_DEVICES - 1)

Signed-off-by: Ken CC <ken.ccao@gmail.com>
---
 hw/qdev-properties.c |    2 ++
 hw/qdev.h            |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 9219cd7..96d814c 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -514,6 +514,8 @@ static int parse_pci_devfn(DeviceState *dev, Property *prop, const char *str)
             return -EINVAL;
         }
     }
+    if (slot > MAX_PCI_SLOTS)
+        return -EINVAL;
     if (str[n] != '\0')
         return -EINVAL;
     if (fn > 7)
diff --git a/hw/qdev.h b/hw/qdev.h
index 678f8b7..fcfe52e 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -7,6 +7,9 @@
 #include "qemu-char.h"
 #include "qemu-option.h"
 
+
+#define MAX_PCI_SLOTS 0x1f
+
 typedef struct Property Property;
 
 typedef struct PropertyInfo PropertyInfo;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus
  2010-08-24  6:33   ` [Qemu-devel] " Ken CC
@ 2010-08-24  6:51     ` Ken CC
  -1 siblings, 0 replies; 7+ messages in thread
From: Ken CC @ 2010-08-24  6:51 UTC (permalink / raw)
  To: kvm; +Cc: yamahata, qemu-devel

broken thread, please ignore.

On Tue, Aug 24, 2010 at 02:33:51PM +0800, Ken CC wrote:
> assert(devfn < PCIBUS_MAX_DEVICES)
> 
> Signed-off-by: Ken CC <ken.ccao@gmail.com>
> ---
>  hw/pci.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index 02019a1..1e804da 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -747,6 +747,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
>                                           PCIConfigWriteFunc *config_write,
>                                           bool is_bridge)
>  {
> +    assert(devfn < PCIBUS_MAX_DEVICES);
>      if (devfn < 0) {
>          for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
>              devfn += PCI_FUNC_MAX) {
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] Re: [PATCH 2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus
@ 2010-08-24  6:51     ` Ken CC
  0 siblings, 0 replies; 7+ messages in thread
From: Ken CC @ 2010-08-24  6:51 UTC (permalink / raw)
  To: kvm; +Cc: yamahata, qemu-devel

broken thread, please ignore.

On Tue, Aug 24, 2010 at 02:33:51PM +0800, Ken CC wrote:
> assert(devfn < PCIBUS_MAX_DEVICES)
> 
> Signed-off-by: Ken CC <ken.ccao@gmail.com>
> ---
>  hw/pci.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/hw/pci.c b/hw/pci.c
> index 02019a1..1e804da 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -747,6 +747,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
>                                           PCIConfigWriteFunc *config_write,
>                                           bool is_bridge)
>  {
> +    assert(devfn < PCIBUS_MAX_DEVICES);
>      if (devfn < 0) {
>          for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
>              devfn += PCI_FUNC_MAX) {
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus
  2010-08-24  6:33 [PATCH 1/3] PCI: define max devices number on PCIBus as PCIBUS_MAX_DEVICES in pci.h Ken CC
@ 2010-08-24  6:48 ` Ken CC
  0 siblings, 0 replies; 7+ messages in thread
From: Ken CC @ 2010-08-24  6:48 UTC (permalink / raw)
  To: kvm; +Cc: yamahata, qemu-devel

assert(devfn < PCIBUS_MAX_DEVICES)

Signed-off-by: Ken CC <ken.ccao@gmail.com>
---
 hw/pci.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 02019a1..1e804da 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -747,6 +747,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
                                          PCIConfigWriteFunc *config_write,
                                          bool is_bridge)
 {
+    assert(devfn < PCIBUS_MAX_DEVICES);
     if (devfn < 0) {
         for(devfn = bus->devfn_min ; devfn < ARRAY_SIZE(bus->devices);
             devfn += PCI_FUNC_MAX) {


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-08-24  6:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20100824062517.12408.45246.stgit@k1>
2010-08-24  6:33 ` [PATCH 2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus Ken CC
2010-08-24  6:33   ` [Qemu-devel] " Ken CC
2010-08-24  6:51   ` Ken CC
2010-08-24  6:51     ` [Qemu-devel] " Ken CC
2010-08-24  6:34 ` [PATCH 3/3] Check pci slot number in parse_pci_devfn Ken CC
2010-08-24  6:34   ` [Qemu-devel] " Ken CC
2010-08-24  6:33 [PATCH 1/3] PCI: define max devices number on PCIBus as PCIBUS_MAX_DEVICES in pci.h Ken CC
2010-08-24  6:48 ` [PATCH 2/3] pci init: fail qemu if devfn exceeding the max devices number supported on bus Ken CC

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.