Skip to content

Commit

Permalink
[PATCH] swsusp: remove wrong code from data_free
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rafael J. Wysocki authored and Linus Torvalds committed Sep 28, 2005
1 parent 249a677 commit 254b547
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions kernel/power/swsusp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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};
}
}

Expand Down

0 comments on commit 254b547

Please sign in to comment.