* [PATCH v2] gpio/omap: fix possible memory leak in omap2_gpio_dev_init()
@ 2012-09-03 12:42 Wei Yongjun
2012-09-07 22:06 ` Kevin Hilman
0 siblings, 1 reply; 4+ messages in thread
From: Wei Yongjun @ 2012-09-03 12:42 UTC (permalink / raw)
To: linux-arm-kernel
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
pdata and pdata->regs have been allocated in this function and
should be freed before leaving it, and in the other error handling
cases too.
spatch with a semantic match is used to found this problem.
(http://coccinelle.lip6.fr/)
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
arch/arm/mach-omap2/gpio.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/mach-omap2/gpio.c b/arch/arm/mach-omap2/gpio.c
index 9ad7d48..fe626e90 100644
--- a/arch/arm/mach-omap2/gpio.c
+++ b/arch/arm/mach-omap2/gpio.c
@@ -60,6 +60,7 @@ static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
pdata->regs = kzalloc(sizeof(struct omap_gpio_reg_offs), GFP_KERNEL);
if (!pdata->regs) {
pr_err("gpio%d: Memory allocation failed\n", id);
+ kfree(pdata);
return -ENOMEM;
}
@@ -121,6 +122,7 @@ static int __init omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
break;
default:
WARN(1, "Invalid gpio bank_type\n");
+ kfree(pdata->regs);
kfree(pdata);
return -EINVAL;
}
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] gpio/omap: fix possible memory leak in omap2_gpio_dev_init()
2012-09-03 12:42 [PATCH v2] gpio/omap: fix possible memory leak in omap2_gpio_dev_init() Wei Yongjun
@ 2012-09-07 22:06 ` Kevin Hilman
2012-09-07 22:24 ` Tony Lindgren
0 siblings, 1 reply; 4+ messages in thread
From: Kevin Hilman @ 2012-09-07 22:06 UTC (permalink / raw)
To: linux-arm-kernel
Wei Yongjun <weiyj.lk@gmail.com> writes:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> pdata and pdata->regs have been allocated in this function and
> should be freed before leaving it, and in the other error handling
> cases too.
>
> spatch with a semantic match is used to found this problem.
> (http://coccinelle.lip6.fr/)
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Kevin Hilman <khilman@ti.com>
Tony, can you pick this one up for fixes?
Thanks,
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] gpio/omap: fix possible memory leak in omap2_gpio_dev_init()
2012-09-07 22:06 ` Kevin Hilman
@ 2012-09-07 22:24 ` Tony Lindgren
2012-09-07 22:37 ` Kevin Hilman
0 siblings, 1 reply; 4+ messages in thread
From: Tony Lindgren @ 2012-09-07 22:24 UTC (permalink / raw)
To: linux-arm-kernel
* Kevin Hilman <khilman@deeprootsystems.com> [120907 15:07]:
> Wei Yongjun <weiyj.lk@gmail.com> writes:
>
> > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> >
> > pdata and pdata->regs have been allocated in this function and
> > should be freed before leaving it, and in the other error handling
> > cases too.
> >
> > spatch with a semantic match is used to found this problem.
> > (http://coccinelle.lip6.fr/)
> >
> > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Acked-by: Kevin Hilman <khilman@ti.com>
>
> Tony, can you pick this one up for fixes?
Sure, is fixes-noncritical OK for this one?
Tony
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] gpio/omap: fix possible memory leak in omap2_gpio_dev_init()
2012-09-07 22:24 ` Tony Lindgren
@ 2012-09-07 22:37 ` Kevin Hilman
0 siblings, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2012-09-07 22:37 UTC (permalink / raw)
To: linux-arm-kernel
Tony Lindgren <tony@atomide.com> writes:
> * Kevin Hilman <khilman@deeprootsystems.com> [120907 15:07]:
>> Wei Yongjun <weiyj.lk@gmail.com> writes:
>>
>> > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>> >
>> > pdata and pdata->regs have been allocated in this function and
>> > should be freed before leaving it, and in the other error handling
>> > cases too.
>> >
>> > spatch with a semantic match is used to found this problem.
>> > (http://coccinelle.lip6.fr/)
>> >
>> > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>>
>> Acked-by: Kevin Hilman <khilman@ti.com>
>>
>> Tony, can you pick this one up for fixes?
>
> Sure, is fixes-noncritical OK for this one?
Yes.
Kevin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-07 22:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-03 12:42 [PATCH v2] gpio/omap: fix possible memory leak in omap2_gpio_dev_init() Wei Yongjun
2012-09-07 22:06 ` Kevin Hilman
2012-09-07 22:24 ` Tony Lindgren
2012-09-07 22:37 ` Kevin Hilman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox