* [PATCH] Memory leak in block/cciss.c driver
@ 2003-09-21 4:02 Felipe W Damasio
0 siblings, 0 replies; only message in thread
From: Felipe W Damasio @ 2003-09-21 4:02 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Cciss-discuss, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 266 bytes --]
Hi Linus,
Patch against 2.6-test5 which removes a few memory leaks from the cciss
block driver.
Bug found by smatch checker.
Please apply,
Cheers.
Felipe
--
It's most certainly GNU/Linux, not Linux. Read more at
http://www.gnu.org/gnu/why-gnu-linux.html
[-- Attachment #2: cciss-leak.patch --]
[-- Type: text/plain, Size: 1071 bytes --]
--- linux-2.6.0-test5/drivers/block/cciss.c Mon Sep 8 16:50:32 2003
+++ linux-2.6.0-test5-fwd/drivers/block/cciss.c Sun Sep 21 00:46:33 2003
@@ -754,16 +754,24 @@
status = -ENOMEM;
goto cleanup1;
}
- if (copy_from_user(ioc, (void *) arg, sizeof(*ioc)))
- return -EFAULT;
+ if (copy_from_user(ioc, (void *) arg, sizeof(*ioc))) {
+ status = -EFAULT;
+ goto cleanup1;
+ }
if ((ioc->buf_size < 1) &&
- (ioc->Request.Type.Direction != XFER_NONE))
- return -EINVAL;
+ (ioc->Request.Type.Direction != XFER_NONE)) {
+ status = -EINVAL;
+ goto cleanup1;
+ }
/* Check kmalloc limits using all SGs */
- if (ioc->malloc_size > MAX_KMALLOC_SIZE)
- return -EINVAL;
- if (ioc->buf_size > ioc->malloc_size * MAXSGENTRIES)
- return -EINVAL;
+ if (ioc->malloc_size > MAX_KMALLOC_SIZE) {
+ status = -EINVAL;
+ goto cleanup1;
+ }
+ if (ioc->buf_size > ioc->malloc_size * MAXSGENTRIES) {
+ status = -EINVAL;
+ goto cleanup1;
+ }
buff = (unsigned char **) kmalloc(MAXSGENTRIES *
sizeof(char *), GFP_KERNEL);
if (!buff) {
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-09-21 3:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-21 4:02 [PATCH] Memory leak in block/cciss.c driver Felipe W Damasio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox