All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@hp.com>
To: "Yang, Sheng" <sheng.yang@intel.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: Tue, 12 May 2009 21:55:50 -0600	[thread overview]
Message-ID: <1242186950.4878.18.camel@2710p.home> (raw)
In-Reply-To: <200905131136.57555.sheng.yang@intel.com>

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;

> 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,

Alex



  reply	other threads:[~2009-05-13  3:55 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 [this message]
2009-05-13  4:09       ` Yang, Sheng
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=1242186950.4878.18.camel@2710p.home \
    --to=alex.williamson@hp.com \
    --cc=kvm@vger.kernel.org \
    --cc=sheng.yang@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.