From: Dan Carpenter <dan.carpenter@oracle.com>
To: jroedel@suse.de
Cc: kvm@vger.kernel.org
Subject: re: kvm: irqchip: Break up high order allocations of kvm_irq_routing_table
Date: Fri, 26 Jun 2015 12:00:22 +0300 [thread overview]
Message-ID: <20150626090022.GA27118@mwanda> (raw)
Hello Joerg Roedel,
The patch e73f61e41f3b: "kvm: irqchip: Break up high order
allocations of kvm_irq_routing_table" from May 8, 2015, leads to the
following static checker warning:
arch/x86/kvm/../../../virt/kvm/irqchip.c:238 kvm_set_irq_routing()
warn: possible memory leak of 'e'
arch/x86/kvm/../../../virt/kvm/irqchip.c
207 for (i = 0; i < nr; ++i) {
208 struct kvm_kernel_irq_routing_entry *e;
209
210 r = -ENOMEM;
211 e = kzalloc(sizeof(*e), GFP_KERNEL);
212 if (!e)
213 goto out;
214
215 r = -EINVAL;
216 if (ue->flags)
217 goto out;
^^^^^^^^
Leaked here. Move in front of the allocation?
218 r = setup_routing_entry(new, e, ue);
219 if (r)
220 goto out;
221 ++ue;
222 }
223
224 mutex_lock(&kvm->irq_lock);
225 old = kvm->irq_routing;
226 rcu_assign_pointer(kvm->irq_routing, new);
227 kvm_irq_routing_update(kvm);
228 mutex_unlock(&kvm->irq_lock);
229
230 synchronize_srcu_expedited(&kvm->irq_srcu);
231
232 new = old;
233 r = 0;
234
235 out:
236 free_irq_routing_table(new);
237
238 return r;
239 }
regards,
dan carpenter
next reply other threads:[~2015-06-26 9:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-26 9:00 Dan Carpenter [this message]
2015-06-26 16:11 ` [PATCH] kvm: irqchip: Fix possible memory leak in kvm_set_irq_routing() Joerg Roedel
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=20150626090022.GA27118@mwanda \
--to=dan.carpenter@oracle.com \
--cc=jroedel@suse.de \
--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