From 48873143c882995a35a3318a2c8b8f8b4b2880e0 Mon Sep 17 00:00:00 2001 From: Alex Williamson Date: Tue, 24 Jan 2012 15:45:17 +0100 Subject: [PATCH 1/5] pci-assign: Fix PCI_EXP_FLAGS_TYPE shift RH-Author: Alex Williamson Message-id: <20120124154517.27090.86097.stgit@bling.home> Patchwork-id: 36786 O-Subject: [PATCH 1/4] pci-assign: Fix PCI_EXP_FLAGS_TYPE shift Bugzilla: 754565 RH-Acked-by: Laszlo Ersek RH-Acked-by: Markus Armbruster RH-Acked-by: Don Dutile Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=754565 Upstream commit: b4eccd18591f3d639bc3c923e299b3c1241a0b3f 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 Signed-off-by: Avi Kivity --- hw/device-assignment.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Signed-off-by: Michal Novotny --- hw/device-assignment.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index 33a4b45..388cd2f 100644 --- a/hw/device-assignment.c +++ b/hw/device-assignment.c @@ -1474,7 +1474,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.7.5