From: Nishanth Menon <nm@ti.com>
To: Kulikov Vasiliy <segooon@gmail.com>
Cc: "kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@suse.de>,
"Sapiens, Rene" <rene.sapiens@ti.com>,
Felipe Contreras <felipe.contreras@gmail.com>,
"Ramirez Luna, Omar" <omar.ramirez@ti.com>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH 7/9] staging: tidspbridge: fix memory leak
Date: Fri, 30 Jul 2010 12:38:17 +0000 [thread overview]
Message-ID: <4C52C7B9.7000209@ti.com> (raw)
In-Reply-To: <1280488163-20939-1-git-send-email-segooon@gmail.com>
Kulikov Vasiliy had written, on 07/30/2010 06:09 AM, the following:
> dbll_create() leaks pzl_target if target_obj is NULL. Call kzalloc()
> only if memory is used.
>
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
> ---
> drivers/staging/tidspbridge/pmgr/dbll.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/tidspbridge/pmgr/dbll.c b/drivers/staging/tidspbridge/pmgr/dbll.c
> index 3636aa3..86840ce 100644
> --- a/drivers/staging/tidspbridge/pmgr/dbll.c
> +++ b/drivers/staging/tidspbridge/pmgr/dbll.c
> @@ -247,9 +247,9 @@ int dbll_create(struct dbll_tar_obj **target_obj,
> DBC_REQUIRE(pattrs != NULL);
> DBC_REQUIRE(target_obj != NULL);
>
> - /* Allocate DBL target object */
> - pzl_target = kzalloc(sizeof(struct dbll_tar_obj), GFP_KERNEL);
> if (target_obj != NULL) {
> + /* Allocate DBL target object */
> + pzl_target = kzalloc(sizeof(struct dbll_tar_obj), GFP_KERNEL);
> if (pzl_target = NULL) {
> *target_obj = NULL;
> status = -ENOMEM;
I would suggest to add a else branch for if (target_obj != NULL) adding
a status =-ENOMEM if error.
Overall, I guess we need to kick out the DBC_REQUIRE usage.. it is
misleading as it is active only when DEBUG macro is enabled!
--
Regards,
Nishanth Menon
WARNING: multiple messages have this Message-ID (diff)
From: Nishanth Menon <nm@ti.com>
To: Kulikov Vasiliy <segooon@gmail.com>
Cc: "kernel-janitors@vger.kernel.org"
<kernel-janitors@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@suse.de>,
"Sapiens, Rene" <rene.sapiens@ti.com>,
Felipe Contreras <felipe.contreras@gmail.com>,
"Ramirez Luna, Omar" <omar.ramirez@ti.com>,
"devel@driverdev.osuosl.org" <devel@driverdev.osuosl.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH 7/9] staging: tidspbridge: fix memory leak
Date: Fri, 30 Jul 2010 07:38:17 -0500 [thread overview]
Message-ID: <4C52C7B9.7000209@ti.com> (raw)
In-Reply-To: <1280488163-20939-1-git-send-email-segooon@gmail.com>
Kulikov Vasiliy had written, on 07/30/2010 06:09 AM, the following:
> dbll_create() leaks pzl_target if target_obj is NULL. Call kzalloc()
> only if memory is used.
>
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
> ---
> drivers/staging/tidspbridge/pmgr/dbll.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/tidspbridge/pmgr/dbll.c b/drivers/staging/tidspbridge/pmgr/dbll.c
> index 3636aa3..86840ce 100644
> --- a/drivers/staging/tidspbridge/pmgr/dbll.c
> +++ b/drivers/staging/tidspbridge/pmgr/dbll.c
> @@ -247,9 +247,9 @@ int dbll_create(struct dbll_tar_obj **target_obj,
> DBC_REQUIRE(pattrs != NULL);
> DBC_REQUIRE(target_obj != NULL);
>
> - /* Allocate DBL target object */
> - pzl_target = kzalloc(sizeof(struct dbll_tar_obj), GFP_KERNEL);
> if (target_obj != NULL) {
> + /* Allocate DBL target object */
> + pzl_target = kzalloc(sizeof(struct dbll_tar_obj), GFP_KERNEL);
> if (pzl_target == NULL) {
> *target_obj = NULL;
> status = -ENOMEM;
I would suggest to add a else branch for if (target_obj != NULL) adding
a status =-ENOMEM if error.
Overall, I guess we need to kick out the DBC_REQUIRE usage.. it is
misleading as it is active only when DEBUG macro is enabled!
--
Regards,
Nishanth Menon
next prev parent reply other threads:[~2010-07-30 12:38 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-30 11:09 [PATCH 7/9] staging: tidspbridge: fix memory leak Kulikov Vasiliy
2010-07-30 11:09 ` Kulikov Vasiliy
2010-07-30 12:38 ` Nishanth Menon [this message]
2010-07-30 12:38 ` Nishanth Menon
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=4C52C7B9.7000209@ti.com \
--to=nm@ti.com \
--cc=devel@driverdev.osuosl.org \
--cc=felipe.contreras@gmail.com \
--cc=gregkh@suse.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=omar.ramirez@ti.com \
--cc=rene.sapiens@ti.com \
--cc=segooon@gmail.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.