From: Jae Hyun Yoo <jae.hyun.yoo@linux•intel.com>
To: Navid Emamdoost <navid.emamdoost@gmail•com>
Cc: linux-aspeed@lists•ozlabs.org, Andrew Jeffery <andrew@aj•id.au>,
Kangjie Lu <kjlu@umn•edu>,
openbmc@lists•ozlabs.org, Eddie James <eajames@linux•ibm.com>,
LKML <linux-kernel@vger•kernel.org>,
Navid Emamdoost <emamd001@umn•edu>, Joel Stanley <joel@jms•id.au>,
Stephen McCamant <smccaman@umn•edu>,
Mauro Carvalho Chehab <mchehab@kernel•org>,
linux-arm-kernel@lists•infradead.org,
linux-media@vger•kernel.org
Subject: Re: [PATCH v2] media: aspeed-video: Fix memory leaks in aspeed_video_probe
Date: Mon, 28 Oct 2019 10:08:44 -0700 [thread overview]
Message-ID: <da959329-aa40-b6e7-dcc9-48183a8da716@linux.intel.com> (raw)
In-Reply-To: <CAEkB2ETFNFKtGTo+HZ4L9uzr-W1CTeuGAwfKqm8hX5fx7d8dbQ@mail.gmail.com>
On 10/28/2019 10:06 AM, Navid Emamdoost wrote:
> On Mon, Oct 28, 2019 at 12:01 PM Jae Hyun Yoo
> <jae.hyun.yoo@linux•intel.com> wrote:
>>
>> On 10/28/2019 9:58 AM, Navid Emamdoost wrote:
>>> In the implementation of aspeed_video_probe() the allocated memory for
>>> video should be released if either devm_ioremap_resource()
>>> or aspeed_video_init() or aspeed_video_setup_video() fails. Replace
>>> kzalloc() with devm_kzalloc to avoid explicit release for video.
>>>
>>> Fixes: d2b4387f3bdf ("media: platform: Add Aspeed Video Engine driver")
>>> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail•com>
>>> ---
>>> Changes in v2:
>>> -- replace kzalloc with devm_kzalloc based on Jae Hyun Yoo
>>> suggestion
>>>
>>> drivers/media/platform/aspeed-video.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c
>>> index eb12f3793062..2aa8ea2f9824 100644
>>> --- a/drivers/media/platform/aspeed-video.c
>>> +++ b/drivers/media/platform/aspeed-video.c
>>> @@ -1646,7 +1646,7 @@ static int aspeed_video_probe(struct platform_device *pdev)
>>> {
>>> int rc;
>>> struct resource *res;
>>> - struct aspeed_video *video = kzalloc(sizeof(*video), GFP_KERNEL);
>>> + struct aspeed_video *video = devm_kzalloc(sizeof(*video), GFP_KERNEL);
>>
>> It can't be compiled. devm_kzalloc should have 3 parameters.
>>
>
> Oops! my bad. Do you think such a list of parameters is fine:
> devm_kzalloc(&pdev->dev, sizeof(*video), GFP_KERNEL);
Yes, it's fine.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists•infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-10-28 17:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-26 4:25 [PATCH] media: aspeed-video: Fix memory leaks in aspeed_video_probe Navid Emamdoost
2019-10-27 6:55 ` Markus Elfring
2019-10-28 16:27 ` Jae Hyun Yoo
2019-10-28 16:30 ` Navid Emamdoost
2019-10-28 16:58 ` [PATCH v2] " Navid Emamdoost
2019-10-28 17:01 ` Jae Hyun Yoo
2019-10-28 17:06 ` Navid Emamdoost
2019-10-28 17:08 ` Jae Hyun Yoo [this message]
2019-10-28 17:18 ` [PATCH v3] " Navid Emamdoost
2019-10-28 17:55 ` Jae Hyun Yoo
2019-11-08 20:37 ` Eddie James
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=da959329-aa40-b6e7-dcc9-48183a8da716@linux.intel.com \
--to=jae.hyun.yoo@linux$(echo .)intel.com \
--cc=andrew@aj$(echo .)id.au \
--cc=eajames@linux$(echo .)ibm.com \
--cc=emamd001@umn$(echo .)edu \
--cc=joel@jms$(echo .)id.au \
--cc=kjlu@umn$(echo .)edu \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
--cc=linux-aspeed@lists$(echo .)ozlabs.org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-media@vger$(echo .)kernel.org \
--cc=mchehab@kernel$(echo .)org \
--cc=navid.emamdoost@gmail$(echo .)com \
--cc=openbmc@lists$(echo .)ozlabs.org \
--cc=smccaman@umn$(echo .)edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox