diff options
Diffstat (limited to 'fs/squashfs')
-rw-r--r-- | fs/squashfs/lzo_wrapper.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/squashfs/lzo_wrapper.c b/fs/squashfs/lzo_wrapper.c index e1f86ded0ee5..5d87789bf1c1 100644 --- a/fs/squashfs/lzo_wrapper.c +++ b/fs/squashfs/lzo_wrapper.c | |||
@@ -40,13 +40,15 @@ struct squashfs_lzo { | |||
40 | 40 | ||
41 | static void *lzo_init(struct squashfs_sb_info *msblk) | 41 | static void *lzo_init(struct squashfs_sb_info *msblk) |
42 | { | 42 | { |
43 | int block_size = max_t(int, msblk->block_size, SQUASHFS_METADATA_SIZE); | ||
44 | |||
43 | struct squashfs_lzo *stream = kzalloc(sizeof(*stream), GFP_KERNEL); | 45 | struct squashfs_lzo *stream = kzalloc(sizeof(*stream), GFP_KERNEL); |
44 | if (stream == NULL) | 46 | if (stream == NULL) |
45 | goto failed; | 47 | goto failed; |
46 | stream->input = vmalloc(msblk->block_size); | 48 | stream->input = vmalloc(block_size); |
47 | if (stream->input == NULL) | 49 | if (stream->input == NULL) |
48 | goto failed; | 50 | goto failed; |
49 | stream->output = vmalloc(msblk->block_size); | 51 | stream->output = vmalloc(block_size); |
50 | if (stream->output == NULL) | 52 | if (stream->output == NULL) |
51 | goto failed2; | 53 | goto failed2; |
52 | 54 | ||
@@ -80,7 +82,7 @@ static int lzo_uncompress(struct squashfs_sb_info *msblk, void **buffer, | |||
80 | struct squashfs_lzo *stream = msblk->stream; | 82 | struct squashfs_lzo *stream = msblk->stream; |
81 | void *buff = stream->input; | 83 | void *buff = stream->input; |
82 | int avail, i, bytes = length, res; | 84 | int avail, i, bytes = length, res; |
83 | size_t out_len = msblk->block_size; | 85 | size_t out_len = srclength; |
84 | 86 | ||
85 | mutex_lock(&msblk->read_data_mutex); | 87 | mutex_lock(&msblk->read_data_mutex); |
86 | 88 | ||