qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] PCI: add param check for api
@ 2015-11-21  7:45 Cao jin
  2016-01-11  8:32 ` Michael Tokarev
  0 siblings, 1 reply; 6+ messages in thread
From: Cao jin @ 2015-11-21  7:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, mst

add param check for pci_add_capability2, as it is a public API.

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
---
 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

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

end of thread, other threads:[~2016-01-12 12:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-21  7:45 [Qemu-devel] [PATCH] PCI: add param check for api Cao jin
2016-01-11  8:32 ` Michael Tokarev
2016-01-11  9:20   ` Paolo Bonzini
2016-01-12  7:22     ` Cao jin
2016-01-12 12:04       ` Paolo Bonzini
2016-01-12  6:39   ` Cao jin

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).