From: Andrew Cooper Subject: [PATCH] x86/msi: Don't dereference pdev before its NULL check Date: Thu, 23 Jul 2015 11:54:32 +0100 Message-ID: <1437648872-16081-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Jan Beulich List-Id: xen-devel@lists.xenproject.org Signed-off-by: Andrew Cooper CC: Jan Beulich --- xen/arch/x86/msi.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c index fa95048..160167c 100644 --- a/xen/arch/x86/msi.c +++ b/xen/arch/x86/msi.c @@ -1345,7 +1345,7 @@ int pci_restore_msi_state(struct pci_dev *pdev) struct msi_desc *entry, *tmp; struct irq_desc *desc; struct msi_msg msg; - u8 slot = PCI_SLOT(pdev->devfn), func = PCI_FUNC(pdev->devfn); + u8 slot, func; unsigned int type = 0, pos = 0; u16 control = 0; @@ -1357,6 +1357,9 @@ int pci_restore_msi_state(struct pci_dev *pdev) if ( !pdev ) return -EINVAL; + slot = PCI_SLOT(pdev->devfn); + func = PCI_FUNC(pdev->devfn); + ret = xsm_resource_setup_pci(XSM_PRIV, (pdev->seg << 16) | (pdev->bus << 8) | pdev->devfn); -- 1.7.10.4