From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: [PATCH 4/6] pci-assign: Fix PCIe lnkcap Date: Wed, 16 Nov 2011 13:46:05 -0700 Message-ID: <20111116204559.23506.46162.stgit@bling.home> References: <20111116203834.23506.21535.stgit@bling.home> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: jan.kiszka@siemens.com, alex.williamson@redhat.com, yongjie.ren@intel.com To: kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:45700 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753556Ab1KPUqH (ORCPT ); Wed, 16 Nov 2011 15:46:07 -0500 In-Reply-To: <20111116203834.23506.21535.stgit@bling.home> Sender: kvm-owner@vger.kernel.org List-ID: Another Coverity found issue, lnkcap is a 32bit register and we're masking bits 16 & 17. Fix to uin32_t. Signed-off-by: Alex Williamson --- hw/device-assignment.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index ec302d2..dd92ce0 100644 --- a/hw/device-assignment.c +++ b/hw/device-assignment.c @@ -1240,8 +1240,8 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev) if ((pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_EXP, 0))) { uint8_t version, size = 0; - uint16_t type, devctl, lnkcap, lnksta; - uint32_t devcap; + uint16_t type, devctl, lnksta; + uint32_t devcap, lnkcap; version = pci_get_byte(pci_dev->config + pos + PCI_EXP_FLAGS); version &= PCI_EXP_FLAGS_VERS; @@ -1326,11 +1326,11 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev) pci_set_word(pci_dev->config + pos + PCI_EXP_DEVSTA, 0); /* Link capabilities, expose links and latencues, clear reporting */ - lnkcap = pci_get_word(pci_dev->config + pos + PCI_EXP_LNKCAP); + lnkcap = pci_get_long(pci_dev->config + pos + PCI_EXP_LNKCAP); lnkcap &= (PCI_EXP_LNKCAP_SLS | PCI_EXP_LNKCAP_MLW | PCI_EXP_LNKCAP_ASPMS | PCI_EXP_LNKCAP_L0SEL | PCI_EXP_LNKCAP_L1EL); - pci_set_word(pci_dev->config + pos + PCI_EXP_LNKCAP, lnkcap); + pci_set_long(pci_dev->config + pos + PCI_EXP_LNKCAP, lnkcap); pci_set_word(pci_dev->wmask + pos + PCI_EXP_LNKCAP, PCI_EXP_LNKCTL_ASPMC | PCI_EXP_LNKCTL_RCB | PCI_EXP_LNKCTL_CCC | PCI_EXP_LNKCTL_ES |