[libvirt] [PATCH 2/2] device_conf: PCI address pci_0000_00_00_0 is also valid

Pavel Hrdina phrdina at redhat.com
Tue Aug 5 16:18:31 UTC 2014


All the variables used for pci addr in virDevicePCIAddress are
unsigned and therefore in this validation function they never cannot
be less than zero. This check will fail only for the address above,
but that address is valid so we can safely return true instead.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1055331

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 src/conf/device_conf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 61c73dc..797b2b6 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -44,7 +44,8 @@ bool virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr)
     /* PCI bus has 32 slots and 8 functions per slot */
     if (addr->slot >= 32 || addr->function >= 8)
         return false;
-    return addr->domain || addr->bus || addr->slot;
+
+    return true;
 }
 
 
-- 
1.8.5.5




More information about the libvir-list mailing list