Re: [RESEND] pci: add support for VMD domains

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Laine,

Here's an alternate patch which is probably a lot less potentially
harmful. Please let me know what you think:


commit 931ac8a0a32c3399c92efd18e4478342aedec9e1
Author: Jon Derrick <jonathan.derrick@xxxxxxxxx>
Date:   Wed Aug 9 13:10:01 2017 -0600

    pci: Restrict devices to 16-bit domains

    Most pci devices are limited to 16-bit domains, but VMD uses 32-bit
    domains for child devices. In the current VMD model, child devices
    cannot be assigned to VMs. So restrict the domains to 16-bits rather
    than allowing virpci to attempt to enumerate the devices and failing
    with the following error message:

    internal error: dev->name buffer overflow: 10000:00:00.0

    Signed-off-by: Jon Derrick <jonathan.derrick@xxxxxxxxx>

diff --git a/src/util/virpci.c b/src/util/virpci.c
index 2c1b758..7aaaddd 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1769,6 +1769,12 @@ virPCIDeviceNew(unsigned int domain,
     dev->address.slot = slot;
     dev->address.function = function;

+    /* This is already implied by the following snprintf, but restrict
devices
+     * to 16-bit domains to prevent the error message
+     */
+    if (domain > 0xffff)
+        return NULL;
+
     if (snprintf(dev->name, sizeof(dev->name), "%.4x:%.2x:%.2x.%.1x",
                  domain, bus, slot, function) >= sizeof(dev->name)) {
         virReportError(VIR_ERR_INTERNAL_ERROR,

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux