public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Randy.Dunlap" <randy.dunlap@verizon.net>
To: linux-kernel@vger.kernel.org, torvalds@transmeta.com
Subject: [PATCH] do_mounts memory leak
Date: Wed, 05 Feb 2003 13:39:30 -0800	[thread overview]
Message-ID: <3E418492.A7039AB3@verizon.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 136 bytes --]

Hi,

The Stanford Checker identified a memory leak in
init/do_mounts.c.  This patch to 2.5.59 corrects it.
Please apply.

Thanks,
~Randy

[-- Attachment #2: mounts-memleak.patch --]
[-- Type: text/plain, Size: 724 bytes --]

diff -Naur ./init/do_mounts.c%LEAK ./init/do_mounts.c
--- ./init/do_mounts.c%LEAK	Thu Jan 16 18:22:02 2003
+++ ./init/do_mounts.c	Tue Feb  4 21:46:58 2003
@@ -653,12 +653,6 @@
 	/*
 	 * OK, time to copy in the data
 	 */
-	buf = kmalloc(BLOCK_SIZE, GFP_KERNEL);
-	if (buf == 0) {
-		printk(KERN_ERR "RAMDISK: could not allocate buffer\n");
-		goto done;
-	}
-
 	if (sys_ioctl(in_fd, BLKGETSIZE, (unsigned long)&devblocks) < 0)
 		devblocks = 0;
 	else
@@ -669,6 +663,12 @@
 
 	if (devblocks == 0) {
 		printk(KERN_ERR "RAMDISK: could not determine device size\n");
+		goto done;
+	}
+
+	buf = kmalloc(BLOCK_SIZE, GFP_KERNEL);
+	if (buf == 0) {
+		printk(KERN_ERR "RAMDISK: could not allocate buffer\n");
 		goto done;
 	}
 

                 reply	other threads:[~2003-02-05 21:31 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=3E418492.A7039AB3@verizon.net \
    --to=randy.dunlap@verizon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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