aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2011-07-06 02:23:37 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-06 02:23:37 -0400
commite12fe68ce34d60c04bb1ddb1d3cc5c3022388fe4 (patch)
tree83c0e192ccaa4752c80b6131a7d0aa8272b5d0d0 /crypto
parent7329f0d58de01878d9ce4f0be7a76e136f223eef (diff)
parent712ae51afd55b20c04c5383d02ba5d10233313b1 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'crypto')
-rw-r--r--crypto/deflate.c7
-rw-r--r--crypto/zlib.c7
2 files changed, 6 insertions, 8 deletions
diff --git a/crypto/deflate.c b/crypto/deflate.c
index b5ccae29be74..b0165ecad0c5 100644
--- a/crypto/deflate.c
+++ b/crypto/deflate.c
@@ -32,7 +32,6 @@
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/mm.h> 33#include <linux/mm.h>
34#include <linux/net.h> 34#include <linux/net.h>
35#include <linux/slab.h>
36 35
37#define DEFLATE_DEF_LEVEL Z_DEFAULT_COMPRESSION 36#define DEFLATE_DEF_LEVEL Z_DEFAULT_COMPRESSION
38#define DEFLATE_DEF_WINBITS 11 37#define DEFLATE_DEF_WINBITS 11
@@ -73,7 +72,7 @@ static int deflate_decomp_init(struct deflate_ctx *ctx)
73 int ret = 0; 72 int ret = 0;
74 struct z_stream_s *stream = &ctx->decomp_stream; 73 struct z_stream_s *stream = &ctx->decomp_stream;
75 74
76 stream->workspace = kzalloc(zlib_inflate_workspacesize(), GFP_KERNEL); 75 stream->workspace = vzalloc(zlib_inflate_workspacesize());
77 if (!stream->workspace) { 76 if (!stream->workspace) {
78 ret = -ENOMEM; 77 ret = -ENOMEM;
79 goto out; 78 goto out;
@@ -86,7 +85,7 @@ static int deflate_decomp_init(struct deflate_ctx *ctx)
86out: 85out:
87 return ret; 86 return ret;
88out_free: 87out_free:
89 kfree(stream->workspace); 88 vfree(stream->workspace);
90 goto out; 89 goto out;
91} 90}
92 91
@@ -99,7 +98,7 @@ static void deflate_comp_exit(struct deflate_ctx *ctx)
99static void deflate_decomp_exit(struct deflate_ctx *ctx) 98static void deflate_decomp_exit(struct deflate_ctx *ctx)
100{ 99{
101 zlib_inflateEnd(&ctx->decomp_stream); 100 zlib_inflateEnd(&ctx->decomp_stream);
102 kfree(ctx->decomp_stream.workspace); 101 vfree(ctx->decomp_stream.workspace);
103} 102}
104 103
105static int deflate_init(struct crypto_tfm *tfm) 104static int deflate_init(struct crypto_tfm *tfm)
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 }