mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Pavel Machek <pavel@ucw.cz>
Cc: mochel@digitalimplant.org, linux-kernel@vger.kernel.org, akpm@zip.com.au
Subject: Re: Fix memory leak in swsusp
Date: Fri, 11 Jun 2004 20:16:55 +1000	[thread overview]
Message-ID: <20040611101655.GA8208@gondor.apana.org.au> (raw)
In-Reply-To: <20040611094844.GC13834@elf.ucw.cz>

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

On Fri, Jun 11, 2004 at 11:48:44AM +0200, Pavel Machek wrote:
>
> > Thanks, but my question remains: why do we need the memset?  The
> > area allocated is either thrown away because it collides or is
> > overwritten with the pagedir stuff straight away.
> 
> You are right, it should not be needed.

Great.  Here's the patch that removes the memset calls from both
pmdisk and swsusp.  It depends on the previous patches in this
thread.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p --]
[-- Type: text/plain, Size: 809 bytes --]

diff -Nru a/kernel/power/pmdisk.c b/kernel/power/pmdisk.c
--- a/kernel/power/pmdisk.c	2004-06-11 20:14:54 +10:00
+++ b/kernel/power/pmdisk.c	2004-06-11 20:14:54 +10:00
@@ -806,7 +806,6 @@
 
 	err = -ENOMEM;
 	while ((m = (void *) __get_free_pages(GFP_ATOMIC, pagedir_order))) {
-		memset(m, 0, PAGE_SIZE);
 		if (!does_collide_order(old_pagedir, (unsigned long)m,
 					pagedir_order)) {
 			pm_pagedir_nosave = new_pagedir = m;
--- linux-2.5/kernel/power/swsusp.c.orig	2004-06-11 20:14:02.000000000 +1000
+++ linux-2.5/kernel/power/swsusp.c	2004-06-11 20:14:07.000000000 +1000
@@ -936,7 +936,6 @@
 	}
 
 	while ((m = (void *) __get_free_pages(GFP_ATOMIC, pagedir_order))) {
-		memset(m, 0, PAGE_SIZE);
 		if (!does_collide_order(old_pagedir, (unsigned long)m, pagedir_order))
 			break;
 		eaten_memory = m;

  reply	other threads:[~2004-06-11 10:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-09 13:04 Pavel Machek
2004-06-10 10:50 ` Herbert Xu
2004-06-10 10:56   ` Herbert Xu
2004-06-10 20:08     ` Pavel Machek
2004-06-10 21:24     ` Pavel Machek
2004-06-10 23:37       ` Herbert Xu
2004-06-11  9:48         ` Pavel Machek
2004-06-11 10:16           ` Herbert Xu [this message]
2004-06-11 10:23             ` Pavel Machek
2004-06-11 11:03               ` Herbert Xu
2004-06-12  3:17                 ` Nigel Cunningham
2004-06-12  4:00                   ` Andrew Morton
2004-06-12 11:10                     ` Dave Jones
2004-06-13 15:59                       ` Pavel Machek
2004-06-12 22:07                     ` Nigel Cunningham
2004-06-12 23:32                       ` Jeff Sipek
2004-06-13 15:57                         ` Pavel Machek
2004-06-13  8:15                       ` Herbert Xu
2004-06-12  6:45                   ` Herbert Xu
2004-06-12 10:45 pavel
2004-06-12 22:09 ` Nigel Cunningham

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=20040611101655.GA8208@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@digitalimplant.org \
    --cc=pavel@ucw.cz \
    /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

all inboxes | Powered by JetHome®