From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] x86/msi: Don't dereference pdev before its NULL check Date: Thu, 23 Jul 2015 12:57:35 +0100 Message-ID: <55B0D6AF.9060807@citrix.com> References: <1437648872-16081-1-git-send-email-andrew.cooper3@citrix.com> <55B0EFF00200007800094871@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <55B0EFF00200007800094871@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Xen-devel List-Id: xen-devel@lists.xenproject.org On 23/07/15 12:45, Jan Beulich wrote: >>>> On 23.07.15 at 12:54, wrote: >> --- 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); > I think this is the wrong way round - see the alternative patch just > sent. > > Btw, how did you spot this so quickly now but not during review? > Any tool helping with that? Ah - I accidentally neglected to say that it was Coverity. It is hooked automatically into all XenServer builds, and I am being proactive keeping my upstream branch up-to-date, given the volume of code going in at the moment. ~Andrew