public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Yang, Sheng" <sheng.yang@intel.com>
To: Alex Williamson <alex.williamson@hp.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: [PATCH] kvm: device-assignment: Fix kvm_get_irq_route_gsi() return check
Date: Wed, 13 May 2009 12:09:24 +0800	[thread overview]
Message-ID: <200905131209.24578.sheng.yang@intel.com> (raw)
In-Reply-To: <1242186950.4878.18.camel@2710p.home>

On Wednesday 13 May 2009 11:55:50 Alex Williamson wrote:
> On Wed, 2009-05-13 at 11:36 +0800, Yang, Sheng wrote:
> > On Wednesday 13 May 2009 06:14:01 Alex Williamson wrote:
> > > --- a/hw/device-assignment.c
> > > +++ b/hw/device-assignment.c
> > > @@ -798,7 +798,7 @@ static void assigned_dev_update_msi(PCIDevice
> > > *pci_dev, unsigned int ctrl_pos) pci_dev->cap.start + PCI_MSI_DATA_32);
> > >          assigned_dev->entry->type = KVM_IRQ_ROUTING_MSI;
> > >          assigned_dev->entry->gsi = kvm_get_irq_route_gsi(kvm_context);
> > > -        if (assigned_dev->entry->gsi < 0) {
> > > +        if ((int)(assigned_dev->entry->gsi) < 0) {
> > >              perror("assigned_dev_update_msi: kvm_get_irq_route_gsi");
> > >              return;
> > >          }
> >
> > Use a return value(r) seems better.
>
> Hi Sheng,
>
> Do you mean:
>
> r = kvm_get_irq_route_gsi(kvm_context);
> if (r < 0) {
> ...
> }
> assigned_dev->entry->gsi = r;

Yes.

> > And I realized there is memory leak here. Entry seems haven't been freed
> > for error... So does MSI-X...
>
> I hadn't noticed that one, but now that you mention it, yep.  Thanks,

Thanks. :)

-- 
regards
Yang, Sheng


  reply	other threads:[~2009-05-13  4:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-07 17:09 [PATCH] kvm: device-assignment: Catch GSI overflow Alex Williamson
2009-05-07 17:16 ` Alex Williamson
2009-05-08  9:28   ` Sheng Yang
2009-05-12 22:14 ` [PATCH] kvm: device-assignment: Fix kvm_get_irq_route_gsi() return check Alex Williamson
2009-05-13  3:36   ` Yang, Sheng
2009-05-13  3:55     ` Alex Williamson
2009-05-13  4:09       ` Yang, Sheng [this message]
2009-05-13  4:45   ` [PATCH v2] " Alex Williamson
2009-05-13  4:58     ` Yang, Sheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200905131209.24578.sheng.yang@intel.com \
    --to=sheng.yang@intel.com \
    --cc=alex.williamson@hp.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox