[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] PCI: add param check for api
From: |
Cao jin |
Subject: |
[Qemu-devel] [PATCH] PCI: add param check for api |
Date: |
Sat, 21 Nov 2015 15:45:03 +0800 |
add param check for pci_add_capability2, as it is a public API.
Signed-off-by: Cao jin <address@hidden>
---
hw/pci/pci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 168b9cc..6938f64 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2144,6 +2144,9 @@ int pci_add_capability2(PCIDevice *pdev, uint8_t cap_id,
uint8_t *config;
int i, overlapping_cap;
+ assert(size > 0);
+ assert(offset >= PCI_CONFIG_HEADER_SIZE || !offset);
+
if (!offset) {
offset = pci_find_space(pdev, size);
if (!offset) {
--
2.1.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH] PCI: add param check for api,
Cao jin <=