From patchwork Tue May 25 23:08:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Williamson X-Patchwork-Id: 102307 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4PN87fw022596 for ; Tue, 25 May 2010 23:08:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758408Ab0EYXIE (ORCPT ); Tue, 25 May 2010 19:08:04 -0400 Received: from qmta03.emeryville.ca.mail.comcast.net ([76.96.30.32]:57754 "EHLO qmta03.emeryville.ca.mail.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758455Ab0EYXID (ORCPT ); Tue, 25 May 2010 19:08:03 -0400 Received: from omta07.emeryville.ca.mail.comcast.net ([76.96.30.59]) by qmta03.emeryville.ca.mail.comcast.net with comcast id MnVz1e0061GXsucA3z83pC; Tue, 25 May 2010 23:08:03 +0000 Received: from localhost.localdomain ([75.71.122.219]) by omta07.emeryville.ca.mail.comcast.net with comcast id Mz821e00c4k7Kz78Uz832L; Tue, 25 May 2010 23:08:03 +0000 From: Alex Williamson Subject: [PATCH] device-assignment: don't truncate MSIX capabilities table size To: kvm@vger.kernel.org Cc: quintela@redhat.com, chrisw@redhat.com, alex.williamson@redhat.com Date: Tue, 25 May 2010 17:08:01 -0600 Message-ID: <20100525230131.6313.27447.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 25 May 2010 23:08:07 +0000 (UTC) diff --git a/hw/device-assignment.c b/hw/device-assignment.c index d8e7cb4..e254203 100644 --- a/hw/device-assignment.c +++ b/hw/device-assignment.c @@ -1073,7 +1073,7 @@ static int assigned_dev_update_msix_mmio(PCIDevice *pci_dev) else pos = pci_dev->cap.start; - entries_max_nr = pci_dev->config[pos + 2]; + entries_max_nr = *(uint16_t *)(pci_dev->config + pos + 2); entries_max_nr &= PCI_MSIX_TABSIZE; entries_max_nr += 1; @@ -1255,8 +1255,8 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev) entry_nr = assigned_dev_pci_read_word(pci_dev, pos + 2) & PCI_MSIX_TABSIZE; pci_dev->config[pci_dev->cap.start + pci_dev->cap.length] = 0x11; - pci_dev->config[pci_dev->cap.start + - pci_dev->cap.length + 2] = entry_nr; + *(uint16_t *)(pci_dev->config + pci_dev->cap.start + + pci_dev->cap.length + 2) = entry_nr; msix_table_entry = assigned_dev_pci_read_long(pci_dev, pos + PCI_MSIX_TABLE); *(uint32_t *)(pci_dev->config + pci_dev->cap.start +