Hello, i checked the sources of the linux kernel with the static code analysis tool cppcheck. It found a memory leak at file :linux-2.6.31-rc4/arch/powerpc/sysdev/ipic.c at line 739 Take a look at the source: struct ipic * __init ipic_init(struct device_node *node, unsigned int flags) { struct ipic *ipic; struct resource res; u32 temp = 0, ret; ret = of_address_to_resource(node, 0, &res); if (ret) return NULL; ipic = kzalloc(sizeof(*ipic), GFP_KERNEL); if (ipic == NULL) return NULL; ipic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, NR_IPIC_INTS, &ipic_host_ops, 0); if (ipic->irqhost == NULL) 739 return NULL; .... Indeed, the function returns without freeing the memory. A possible solution might be: struct ipic * __init ipic_init(struct device_node *node, unsigned int flags) { struct ipic *ipic; struct resource res; u32 temp = 0, ret; ret = of_address_to_resource(node, 0, &res); if (ret) return NULL; ipic = kzalloc(sizeof(*ipic), GFP_KERNEL); if (ipic == NULL) return NULL; ipic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, NR_IPIC_INTS, &ipic_host_ops, 0); if (ipic->irqhost == NULL) { kfree(ipic); return NULL; } .... Best regards Ettl Martin
It looks like this issue is fixed, can the bug be closed? Thanks, Davidlohr
Can you run please cppcheck against the fixed sources? I have no kernel sources available at the moment. http://sourceforge.net/projects/cppcheck/ Many thanks in advance. Martin 2010/8/9 <bugzilla-daemon@bugzilla.kernel.org> > https://bugzilla.kernel.org/show_bug.cgi?id=13863 > > > Davidlohr Bueso <dave@gnu.org> changed: > > What |Removed |Added > > ---------------------------------------------------------------------------- > CC| |dave@gnu.org > > > > > --- Comment #1 from Davidlohr Bueso <dave@gnu.org> 2010-08-09 21:56:09 > --- > It looks like this issue is fixed, can the bug be closed? > > Thanks, > Davidlohr > > -- > Configure bugmail: https://bugzilla.kernel.org/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You reported the bug. >