public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Pavel Machek <pavel@ucw.cz>
Cc: LKML <linux-kernel@vger.kernel.org>, Andrew Morton <akpm@osdl.org>
Subject: [PATCH 1/3][Fix] swsusp: remove wrong code from data_free
Date: Sun, 25 Sep 2005 20:24:34 +0200	[thread overview]
Message-ID: <200509252024.34415.rjw@sisk.pl> (raw)
In-Reply-To: <200509252018.36867.rjw@sisk.pl>

The following patch removes some wrong code from the data_free() function in
swsusp.

This function could only be called if there's an arror while writing the suspend
image to swap, so it is not triggered easily.  However, if triggered, it would
probably corrupt some memory.

Please apply,
Rafael


Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

Index: linux-2.6.14-rc2-git3/kernel/power/swsusp.c
===================================================================
--- linux-2.6.14-rc2-git3.orig/kernel/power/swsusp.c	2005-09-25 18:45:03.000000000 +0200
+++ linux-2.6.14-rc2-git3/kernel/power/swsusp.c	2005-09-25 18:49:00.000000000 +0200
@@ -402,15 +402,14 @@
 static void data_free(void)
 {
 	swp_entry_t entry;
-	int i;
+	struct pbe * p;
 
-	for (i = 0; i < nr_copy_pages; i++) {
-		entry = (pagedir_nosave + i)->swap_address;
+	for_each_pbe(p, pagedir_nosave) {
+		entry = p->swap_address;
 		if (entry.val)
 			swap_free(entry);
 		else
 			break;
-		(pagedir_nosave + i)->swap_address = (swp_entry_t){0};
 	}
 }
 


  reply	other threads:[~2005-09-25 18:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-25 18:18 [PATCH 0/3] swsusp: fix some obscure bugs Rafael J. Wysocki
2005-09-25 18:24 ` Rafael J. Wysocki [this message]
2005-09-25 18:30 ` [PATCH 2/3][Fix] swsusp: prevent possible memory leak Rafael J. Wysocki
2005-09-25 18:44 ` [PATCH 3/3][Fix] swsusp: prevent swsusp from failing if there's too many pagedir pages Rafael J. Wysocki
2005-09-26 10:33   ` Pavel Machek
2005-09-26 11:11     ` Rafael J. Wysocki
2005-09-26 11:20       ` Pavel Machek
2005-09-26 12:54         ` Rafael J. Wysocki
2005-09-26 14:26           ` Pavel Machek
2005-09-26 19:19             ` Rafael J. Wysocki
2005-09-26 23:22               ` Pavel Machek
2005-09-26 19:29             ` [PATCH][Fix] swsusp: avoid problems if there are too many pages to save Rafael J. Wysocki
2005-09-26 23:14               ` Pavel Machek
2005-09-25 21:47 ` [PATCH 0/3] swsusp: fix some obscure bugs Pavel Machek
2005-09-25 21:59   ` Andrew Morton

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=200509252024.34415.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.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