diff options
-rw-r--r-- | fs/squashfs/zlib_wrapper.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/squashfs/zlib_wrapper.c b/fs/squashfs/zlib_wrapper.c index 7a603874e483..1f4833b87ea3 100644 --- a/fs/squashfs/zlib_wrapper.c +++ b/fs/squashfs/zlib_wrapper.c | |||
@@ -66,8 +66,8 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, | |||
66 | struct buffer_head **bh, int b, int offset, int length, int srclength, | 66 | struct buffer_head **bh, int b, int offset, int length, int srclength, |
67 | int pages) | 67 | int pages) |
68 | { | 68 | { |
69 | int zlib_err = 0, zlib_init = 0; | 69 | int zlib_err, zlib_init = 0; |
70 | int avail, bytes, k = 0, page = 0; | 70 | int k = 0, page = 0; |
71 | z_stream *stream = msblk->stream; | 71 | z_stream *stream = msblk->stream; |
72 | 72 | ||
73 | mutex_lock(&msblk->read_data_mutex); | 73 | mutex_lock(&msblk->read_data_mutex); |
@@ -75,11 +75,10 @@ static int zlib_uncompress(struct squashfs_sb_info *msblk, void **buffer, | |||
75 | stream->avail_out = 0; | 75 | stream->avail_out = 0; |
76 | stream->avail_in = 0; | 76 | stream->avail_in = 0; |
77 | 77 | ||
78 | bytes = length; | ||
79 | do { | 78 | do { |
80 | if (stream->avail_in == 0 && k < b) { | 79 | if (stream->avail_in == 0 && k < b) { |
81 | avail = min(bytes, msblk->devblksize - offset); | 80 | int avail = min(length, msblk->devblksize - offset); |
82 | bytes -= avail; | 81 | length -= avail; |
83 | wait_on_buffer(bh[k]); | 82 | wait_on_buffer(bh[k]); |
84 | if (!buffer_uptodate(bh[k])) | 83 | if (!buffer_uptodate(bh[k])) |
85 | goto release_mutex; | 84 | goto release_mutex; |