From: Kevin Hilman <khilman@deeprootsystems.com>
To: Nishanth Menon <nm@ti.com>, Thara Gopinath <thara@ti.com>
Cc: linux-omap <linux-omap@vger.kernel.org>,
Artem Bityutskiy <Artem.Bityutskiy@nokia.com>,
Peter p2 De Schrijver <peter.de-schrijver@nokia.com>
Subject: Re: [PM-SR][PATCH 1/2 v2] omap3: sr: fix memory leak and simplify the code
Date: Tue, 24 Aug 2010 14:25:01 -0700 [thread overview]
Message-ID: <87vd6zn1oy.fsf@deeprootsystems.com> (raw)
In-Reply-To: <1278687874-26123-1-git-send-email-nm@ti.com> (Nishanth Menon's message of "Fri, 9 Jul 2010 10:04:34 -0500")
Nishanth Menon <nm@ti.com> writes:
> From: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
>
> This patch fixes the following problem indicated by kmemleak:
>
> kmemleak: unreferenced object 0xdf93c280 (size 64):
> kmemleak: backtrace:
> kmemleak: [<c00df6d4>] create_object+0x104/0x200
> kmemleak: [<c00d7638>] kmem_cache_alloc+0xe4/0xf4
> kmemleak: [<c000fc38>] omap_devinit_smartreflex+0x44/0x244
> kmemleak: [<c003a33c>] do_one_initcall+0x5c/0x1b8
> kmemleak: [<c00083fc>] kernel_init+0x94/0x110
> kmemleak: [<c003ba04>] kernel_thread_exit+0x0/0x8
>
> The reason is that 'omap_devinit_smartreflex()' allocates 'sr_data',
> then passes it to 'omap_device_build()', which 'kmemdup()'s it and
> uses the copy. But 'omap_devinit_smartreflex()' never frees 'sr_data'.
>
> This patch make 'sr_data' to be a stack variable, which eliminates
> the memory leak and simplifies the code a bit.
>
> Cc: Kevin Hilman <khilman@deeprootsystems.com>
> Cc: Thara Gopinath <thara@ti.com>,
> Cc: Peter p2 De Schrijver <peter.de-schrijver@nokia.com>
> Cc: Nishanth Menon <nm@ti.com>
>
> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
> Acked-by: Nishanth Menon <nm@ti.com>
> ---
> Changes from V1:
> rebased to latest pm-sr branch
> default of sr_data set to 0 to make it equivalent to kzalloc
>
> NOTE: this probably should be squashed when being send upstream along with
> rest of SR series
Thara, you appear to have fixed this problem differently in your latest
series. Looks like you just ensured kfree() was always done, correct?
In the future, it would be helpful if you would reply to these proposed
fixes on the list so we know if they are incorporated or handled
differently.
Thanks,
Kevin
next prev parent reply other threads:[~2010-08-24 21:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <[PATCH 1/2] omap3: sr: fix memory leak and simplify the code>
2010-07-09 15:04 ` [PM-SR][PATCH 1/2 v2] omap3: sr: fix memory leak and simplify the code Nishanth Menon
2010-07-09 15:36 ` Artem Bityutskiy
2010-08-24 21:25 ` Kevin Hilman [this message]
2010-08-30 13:59 ` Gopinath, Thara
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=87vd6zn1oy.fsf@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=Artem.Bityutskiy@nokia.com \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
--cc=peter.de-schrijver@nokia.com \
--cc=thara@ti.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.