From: Felipe W Damasio <felipewd@terra.com.br>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Cciss-discuss@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH] Memory leak in block/cciss.c driver
Date: Sun, 21 Sep 2003 01:02:38 -0300 [thread overview]
Message-ID: <3F6D22DE.10001@terra.com.br> (raw)
[-- 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) {
reply other threads:[~2003-09-21 3:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3F6D22DE.10001@terra.com.br \
--to=felipewd@terra.com.br \
--cc=Cciss-discuss@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox