diff options
author | Mike Larkin <mlarkin@cvs.openbsd.org> | 2011-11-18 00:28:47 +0000 |
---|---|---|
committer | Mike Larkin <mlarkin@cvs.openbsd.org> | 2011-11-18 00:28:47 +0000 |
commit | f2bc96f3bbda36e71c335605ca26db4e1a9ae13e (patch) | |
tree | e4a3720c9fe2639acdcfff468d6d6838c988525b /sys | |
parent | a6d664e381f009909ccdef4e27b9541ad5c84ba0 (diff) |
fix a corner case in rle processing where the rle byte was the last byte
being written to an output buffer
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/subr_hibernate.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c index 6a974501124..c1174cbf92d 100644 --- a/sys/kern/subr_hibernate.c +++ b/sys/kern/subr_hibernate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_hibernate.c,v 1.25 2011/11/17 23:18:13 mlarkin Exp $ */ +/* $OpenBSD: subr_hibernate.c,v 1.26 2011/11/18 00:28:46 mlarkin Exp $ */ /* * Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl> @@ -1291,6 +1291,19 @@ hibernate_write_chunks(union hibernate_info *hiber_info) rle = uvm_page_rle(inaddr); } + if (out_remaining == 0) { + /* Filled up the page */ + nblocks = PAGE_SIZE / hiber_info->secsize; + + if (hiber_info->io_func(hiber_info->device, + blkctr, (vaddr_t)hibernate_io_page, + PAGE_SIZE, HIB_W, hiber_info->io_page)) + return (1); + + blkctr += nblocks; + out_remaining = PAGE_SIZE; + } + /* Write '0' RLE code */ if (inaddr < range_end) { hibernate_state->hib_stream.avail_in = @@ -1310,6 +1323,19 @@ hibernate_write_chunks(union hibernate_info *hiber_info) out_remaining = hibernate_state->hib_stream.avail_out; } + + if (out_remaining == 0) { + /* Filled up the page */ + nblocks = PAGE_SIZE / hiber_info->secsize; + + if (hiber_info->io_func(hiber_info->device, + blkctr, (vaddr_t)hibernate_io_page, + PAGE_SIZE, HIB_W, hiber_info->io_page)) + return (1); + + blkctr += nblocks; + out_remaining = PAGE_SIZE; + } /* Deflate from temp_inaddr to IO page */ if (inaddr != range_end) |