diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-16 12:11:13 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-16 12:11:13 -0800 |
commit | 5520ebd308927a3beba599a2b68fa8c52f41f43b (patch) | |
tree | b0395c15af7d096e6e6172a9d47bb7a8dec6add0 /fs/squashfs/zlib_wrapper.c | |
parent | d3072e6a7e9bf7aca200370317f8e297be360b17 (diff) | |
parent | 01a678c5a2f41663b8faf03d17e2bbdbf44158a9 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus
* git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus:
Squashfs: simplify CONFIG_SQUASHFS_LZO handling
Squashfs: move squashfs_i() definition from squashfs.h
Squashfs: get rid of default n in Kconfig
Squashfs: add missing check in zlib_wrapper
Squashfs: remove unnecessary variable in zlib_wrapper
Squashfs: Add XZ compression configuration option
Squashfs: add XZ compression support
Diffstat (limited to 'fs/squashfs/zlib_wrapper.c')
-rw-r--r-- | fs/squashfs/zlib_wrapper.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/squashfs/zlib_wrapper.c b/fs/squashfs/zlib_wrapper.c index 7a603874e483..818a5e063faf 100644 --- a/fs/squashfs/zlib_wrapper.c +++ b/fs/squashfs/zlib_wrapper.c @@ -29,7 +29,6 @@ #include "squashfs_fs.h" #include "squashfs_fs_sb.h" -#include "squashfs_fs_i.h" #include "squashfs.h" #include "decompressor.h" @@ -66,8 +65,8 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, struct buffer_head **bh, int b, int offset, int length, int srclength, int pages) { - int zlib_err = 0, zlib_init = 0; - int avail, bytes, k = 0, page = 0; + int zlib_err, zlib_init = 0; + int k = 0, page = 0; z_stream *stream = msblk->stream; mutex_lock(&msblk->read_data_mutex); @@ -75,11 +74,10 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, stream->avail_out = 0; stream->avail_in = 0; - bytes = length; do { if (stream->avail_in == 0 && k < b) { - avail = min(bytes, msblk->devblksize - offset); - bytes -= avail; + int avail = min(length, msblk->devblksize - offset); + length -= avail; wait_on_buffer(bh[k]); if (!buffer_uptodate(bh[k])) goto release_mutex; @@ -128,6 +126,11 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, goto release_mutex; } + if (k < b) { + ERROR("zlib_uncompress error, data remaining\n"); + goto release_mutex; + } + length = stream->total_out; mutex_unlock(&msblk->read_data_mutex); return length; |