lkml.org 
[lkml]   [2005]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/3][Fix] swsusp: remove wrong code from data_free
Date
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};
}
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-09-25 20:48    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean