[PATCH -mm 2/2] swsusp: fix writing progress meter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Due to the wrong value passed to load_image() in swap.c the writing progress
meter could run over 100%.  Fix it.


Signed-off-by: Rafael J. Wysocki <[email protected]>
---
 kernel/power/swap.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

Index: linux-2.6.16-rc3-mm1/kernel/power/swap.c
===================================================================
--- linux-2.6.16-rc3-mm1.orig/kernel/power/swap.c	2006-02-14 23:08:49.000000000 +0100
+++ linux-2.6.16-rc3-mm1/kernel/power/swap.c	2006-02-14 23:09:26.000000000 +0100
@@ -467,7 +467,6 @@ int swsusp_read(void)
 	struct swap_map_handle handle;
 	struct snapshot_handle snapshot;
 	struct swsusp_info *header;
-	unsigned int nr_pages;
 
 	if (IS_ERR(resume_bdev)) {
 		pr_debug("swsusp: block device not initialised\n");
@@ -482,10 +481,8 @@ int swsusp_read(void)
 	error = get_swap_reader(&handle, swsusp_header.image);
 	if (!error)
 		error = swap_read_page(&handle, header);
-	if (!error) {
-		nr_pages = header->image_pages;
-		error = load_image(&handle, &snapshot, nr_pages);
-	}
+	if (!error)
+		error = load_image(&handle, &snapshot, header->pages - 1);
 	release_swap_reader(&handle);
 
 	blkdev_put(resume_bdev);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux