[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4C52C7B9.7000209@ti.com>
Date: Fri, 30 Jul 2010 07:38:17 -0500
From: Nishanth Menon <nm@...com>
To: Kulikov Vasiliy <segooon@...il.com>
CC: "kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...e.de>,
"Sapiens, Rene" <rene.sapiens@...com>,
Felipe Contreras <felipe.contreras@...il.com>,
"Ramirez Luna, Omar" <omar.ramirez@...com>,
"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-omap@...r.kernel.org" <linux-omap@...r.kernel.org>
Subject: Re: [PATCH 7/9] staging: tidspbridge: fix memory leak
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@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists