* leak in mtd/devices/phram.c
@ 2007-05-20 20:09 Eric Sesterhenn / Snakebyte
2007-05-20 20:49 ` Jörn Engel
2007-05-22 7:46 ` MikeW
0 siblings, 2 replies; 3+ messages in thread
From: Eric Sesterhenn / Snakebyte @ 2007-05-20 20:09 UTC (permalink / raw)
To: joern; +Cc: linux-mtd
hi,
coverity spotted this leak in mtd/devices/phram.c (bug id #1512),
when register_device() fails, we dont kfree() name and leak it,
attached patch should fix this.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6/drivers/mtd/devices/phram.c.orig 2007-05-20 22:04:24.000000000 +0200
+++ linux-2.6/drivers/mtd/devices/phram.c 2007-05-20 22:06:12.000000000 +0200
@@ -276,7 +276,9 @@ static int phram_setup(const char *val,
parse_err("illegal device length\n");
}
- register_device(name, start, len);
+ ret = register_device(name, start, len);
+ if (ret)
+ kfree(name);
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: leak in mtd/devices/phram.c
2007-05-20 20:09 leak in mtd/devices/phram.c Eric Sesterhenn / Snakebyte
@ 2007-05-20 20:49 ` Jörn Engel
2007-05-22 7:46 ` MikeW
1 sibling, 0 replies; 3+ messages in thread
From: Jörn Engel @ 2007-05-20 20:49 UTC (permalink / raw)
To: Eric Sesterhenn / Snakebyte; +Cc: linux-mtd, joern
[-- Attachment #1: Type: text/plain, Size: 976 bytes --]
On Sun, 20 May 2007 22:09:37 +0200, Eric Sesterhenn / Snakebyte wrote:
>
> coverity spotted this leak in mtd/devices/phram.c (bug id #1512),
> when register_device() fails, we dont kfree() name and leak it,
> attached patch should fix this.
>
> Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Acked-by: Jörn Engel <joern@lazybastard.org>
> --- linux-2.6/drivers/mtd/devices/phram.c.orig 2007-05-20 22:04:24.000000000 +0200
> +++ linux-2.6/drivers/mtd/devices/phram.c 2007-05-20 22:06:12.000000000 +0200
> @@ -276,7 +276,9 @@ static int phram_setup(const char *val,
> parse_err("illegal device length\n");
> }
>
> - register_device(name, start, len);
> + ret = register_device(name, start, len);
> + if (ret)
> + kfree(name);
>
> return 0;
> }
>
Jörn
--
I can say that I spend most of my time fixing bugs even if I have lots
of new features to implement in mind, but I give bugs more priority.
-- Andrea Arcangeli, 2000
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: leak in mtd/devices/phram.c
2007-05-20 20:09 leak in mtd/devices/phram.c Eric Sesterhenn / Snakebyte
2007-05-20 20:49 ` Jörn Engel
@ 2007-05-22 7:46 ` MikeW
1 sibling, 0 replies; 3+ messages in thread
From: MikeW @ 2007-05-22 7:46 UTC (permalink / raw)
To: linux-mtd
Eric Sesterhenn / Snakebyte <snakebyte <at> gmx.de> writes:
>
> hi,
>
> coverity spotted this leak in mtd/devices/phram.c (bug id #1512),
> when register_device() fails, we dont kfree() name and leak it,
> attached patch should fix this.
>
> Signed-off-by: Eric Sesterhenn <snakebyte <at> gmx.de>
It's good that the drivers are now getting audited for kmalloc/kfree
(see other recent kfree patch).
Keep it up !! How about a driver memory leak reg-test ?!
Regards,
MikeW
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-05-22 7:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-20 20:09 leak in mtd/devices/phram.c Eric Sesterhenn / Snakebyte
2007-05-20 20:49 ` Jörn Engel
2007-05-22 7:46 ` MikeW
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox