aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/zlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/zlib.c')
-rw-r--r--crypto/zlib.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/crypto/zlib.c b/crypto/zlib.c
index d11d761a5e41..06b62e5cdcc7 100644
--- a/crypto/zlib.c
+++ b/crypto/zlib.c
@@ -29,7 +29,6 @@
29#include <linux/interrupt.h> 29#include <linux/interrupt.h>
30#include <linux/mm.h> 30#include <linux/mm.h>
31#include <linux/net.h> 31#include <linux/net.h>
32#include <linux/slab.h>
33 32
34#include <crypto/internal/compress.h> 33#include <crypto/internal/compress.h>
35 34
@@ -60,7 +59,7 @@ static void zlib_decomp_exit(struct zlib_ctx *ctx)
60 59
61 if (stream->workspace) { 60 if (stream->workspace) {
62 zlib_inflateEnd(stream); 61 zlib_inflateEnd(stream);
63 kfree(stream->workspace); 62 vfree(stream->workspace);
64 stream->workspace = NULL; 63 stream->workspace = NULL;
65 } 64 }
66} 65}
@@ -228,13 +227,13 @@ static int zlib_decompress_setup(struct crypto_pcomp *tfm, void *params,
228 ? nla_get_u32(tb[ZLIB_DECOMP_WINDOWBITS]) 227 ? nla_get_u32(tb[ZLIB_DECOMP_WINDOWBITS])
229 : DEF_WBITS; 228 : DEF_WBITS;
230 229
231 stream->workspace = kzalloc(zlib_inflate_workspacesize(), GFP_KERNEL); 230 stream->workspace = vzalloc(zlib_inflate_workspacesize());
232 if (!stream->workspace) 231 if (!stream->workspace)
233 return -ENOMEM; 232 return -ENOMEM;
234 233
235 ret = zlib_inflateInit2(stream, ctx->decomp_windowBits); 234 ret = zlib_inflateInit2(stream, ctx->decomp_windowBits);
236 if (ret != Z_OK) { 235 if (ret != Z_OK) {
237 kfree(stream->workspace); 236 vfree(stream->workspace);
238 stream->workspace = NULL; 237 stream->workspace = NULL;
239 return -EINVAL; 238 return -EINVAL;
240 } 239 }