aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2005-09-27 21:45:31 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-28 07:46:40 -0700
commit254b54771cc4c00002f796be65d2885191dca9dc (patch)
treebb9503e93d40da3f5a19aa2db45f3e31338e5a63 /kernel
parent249a6771afcdfaca0ac178f63343aff2c4dc2853 (diff)
[PATCH] swsusp: remove wrong code from data_free
The following patch removes some wrong code from the data_free() function in swsusp. This function could only be called if there's an error while writing the suspend image to swap, so it is not triggered easily. However, if triggered, it would probably corrupt some memory. Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/power/swsusp.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 1cc9ff25e47..8aef1b49150 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -402,15 +402,14 @@ static int write_page(unsigned long addr, swp_entry_t * loc)
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};
}
}