[PATCH stable-0.15 2/6] pci-assign: Fix PCI_EXP_FLAGS_TYPE shift

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

 



From: Alex Williamson <alex.williamson@xxxxxxxxxx>

Coverity found that we're doing (uint16_t)type & 0xf0 >> 8.
This is obviously always 0x0, so our attempt to filter out
some device types thinks everything is an endpoint.  Fix
shift amount.

Signed-off-by: Alex Williamson <alex.williamson@xxxxxxxxxx>
Signed-off-by: Avi Kivity <avi@xxxxxxxxxx>
(cherry picked from commit b4eccd18591f3d639bc3c923e299b3c1241a0b3f)

Signed-off-by: Andreas Färber <afaerber@xxxxxxx>
---
 hw/device-assignment.c |    2 +-
 1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)

diff --git a/hw/device-assignment.c b/hw/device-assignment.c
index 177daa4..dc41bfd 100644
--- a/hw/device-assignment.c
+++ b/hw/device-assignment.c
@@ -1459,7 +1459,7 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev)
         }
 
         type = pci_get_word(pci_dev->config + pos + PCI_EXP_FLAGS);
-        type = (type & PCI_EXP_FLAGS_TYPE) >> 8;
+        type = (type & PCI_EXP_FLAGS_TYPE) >> 4;
         if (type != PCI_EXP_TYPE_ENDPOINT &&
             type != PCI_EXP_TYPE_LEG_END && type != PCI_EXP_TYPE_RC_END) {
             fprintf(stderr,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux