* [PATCH] Fix leaks in IBM Hot Plug Controller Driver - ibmphp_init_devno()
@ 2008-03-21 23:07 Jesper Juhl
0 siblings, 0 replies; only message in thread
From: Jesper Juhl @ 2008-03-21 23:07 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: Jyoti Shah, Irene Zubarev, LKML, Jesper Juhl
In drivers/pci/hotplug/ibmphp_core.c::ibmphp_init_devno() we allocate
space dynamically for a PCI irq routing table by calling
pcibios_get_irq_routing_table(), but we never free the allocated space.
This patch frees the allocated space at the function exit points.
Spotted by the Coverity checker. Compile tested only.
Please consider applying.
Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
---
ibmphp_core.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/hotplug/ibmphp_core.c b/drivers/pci/hotplug/ibmphp_core.c
index 87b6b8b..81d0092 100644
--- a/drivers/pci/hotplug/ibmphp_core.c
+++ b/drivers/pci/hotplug/ibmphp_core.c
@@ -148,8 +148,10 @@ int ibmphp_init_devno(struct slot **cur_slot)
len = (rtable->size - sizeof(struct irq_routing_table)) /
sizeof(struct irq_info);
- if (!len)
+ if (!len) {
+ kfree(rtable);
return -1;
+ }
for (loop = 0; loop < len; loop++) {
if ((*cur_slot)->number == rtable->slots[loop].slot) {
if ((*cur_slot)->bus == rtable->slots[loop].bus) {
@@ -187,11 +189,13 @@ int ibmphp_init_devno(struct slot **cur_slot)
debug("rtable->slots[loop].irq[3].link = %x\n",
rtable->slots[loop].irq[3].link);
debug("end of init_devno\n");
+ kfree(rtable);
return 0;
}
}
}
+ kfree(rtable);
return -1;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-03-21 23:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-21 23:07 [PATCH] Fix leaks in IBM Hot Plug Controller Driver - ibmphp_init_devno() Jesper Juhl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®