[PATCH 1/3][Fix] swsusp: remove wrong code from data_free

From: Rafael J. Wysocki
Date: Sun Sep 25 2005 - 13:46:18 EST


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@xxxxxxx>

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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/