lkml.org 
[lkml]   [2019]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH][next] clocksource: davinci-timer: fix memory leak of clockevent on error return
pon., 17 cze 2019 o 13:31 Colin King <colin.king@canonical.com> napisał(a):
>
> From: Colin Ian King <colin.king@canonical.com>
>
> Currently when the call to request_irq falls there is a memory leak of
> clockevent on the error return path. Fix this by kfree'ing clockevent.
>
> Addresses-Coverity: ("Resource leak")
> Fixes: fe3b8194f274 ("clocksource: davinci-timer: add support for clockevents")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/clocksource/timer-davinci.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/clocksource/timer-davinci.c b/drivers/clocksource/timer-davinci.c
> index a9ca02390b66..8512f12e250a 100644
> --- a/drivers/clocksource/timer-davinci.c
> +++ b/drivers/clocksource/timer-davinci.c
> @@ -300,6 +300,7 @@ int __init davinci_timer_register(struct clk *clk,
> "clockevent/tim12", clockevent);
> if (rv) {
> pr_err("Unable to request the clockevent interrupt");
> + kfree(clockevent);
> return rv;
> }
>
> --
> 2.20.1
>

Hi Colin,

I omitted the error checking in this driver on purpose - it doesn't
make sense as the system won't boot without a timer.

Bart

\
 
 \ /
  Last update: 2019-06-24 10:29    [W:0.057 / U:6.356 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site