leak in mtd/devices/phram.c
Subsystems (2)
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 <[email protected]>
drivers/mtd/devices/phram.c renamed from drivers/mtd/devices/phram.c.orig +3 -1
@@ -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 ; }
Quoted 6 lines · Eric Sesterhenn / Snakebyte
coverity spotted this leak in
mtd/devices/phram.c(bug id #1512), whenregister_device()fails, we dontkfree()name and leak it, attached patch should fix this.Signed-off-by Eric Sesterhenn <[email protected]>
Acked-by Jörn Engel <[email protected]>
Quoted 4 lines
drivers/mtd/devices/phram.c static int phram_setup(const char *val, · line 284
Quoted 10 lines
drivers/mtd/devices/phram.c renamed from drivers/mtd/devices/phram.c.orig +3
-1@@ -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
Signature · 3 lines
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
Quoted 8 lines · Eric Sesterhenn / Snakebyte <snakebyte <at> gmx.de> writes:
hi,
coverity spotted this leak in
mtd/devices/phram.c(bug id #1512), whenregister_device()fails, we dontkfree()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