]> git.karo-electronics.de Git - linux-beck.git/commitdiff
crypto: Use vzalloc
authorJoe Perches <joe@perches.com>
Sat, 27 Nov 2010 08:30:39 +0000 (16:30 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 27 Nov 2010 08:30:39 +0000 (16:30 +0800)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/deflate.c
crypto/zlib.c

index 463dc859aa059d6e5f593e6db437e93025974c18..cbc7a33a9600c2b1cb9e9bdc161f3586229b85d1 100644 (file)
@@ -48,12 +48,11 @@ static int deflate_comp_init(struct deflate_ctx *ctx)
        int ret = 0;
        struct z_stream_s *stream = &ctx->comp_stream;
 
-       stream->workspace = vmalloc(zlib_deflate_workspacesize());
+       stream->workspace = vzalloc(zlib_deflate_workspacesize());
        if (!stream->workspace) {
                ret = -ENOMEM;
                goto out;
        }
-       memset(stream->workspace, 0, zlib_deflate_workspacesize());
        ret = zlib_deflateInit2(stream, DEFLATE_DEF_LEVEL, Z_DEFLATED,
                                -DEFLATE_DEF_WINBITS, DEFLATE_DEF_MEMLEVEL,
                                Z_DEFAULT_STRATEGY);
index c3015733c9909cbf90554477a79430b1a31ab286..739b8fca4cea518777f569372ded2e0b751dcd49 100644 (file)
@@ -95,11 +95,10 @@ static int zlib_compress_setup(struct crypto_pcomp *tfm, void *params,
        zlib_comp_exit(ctx);
 
        workspacesize = zlib_deflate_workspacesize();
-       stream->workspace = vmalloc(workspacesize);
+       stream->workspace = vzalloc(workspacesize);
        if (!stream->workspace)
                return -ENOMEM;
 
-       memset(stream->workspace, 0, workspacesize);
        ret = zlib_deflateInit2(stream,
                                tb[ZLIB_COMP_LEVEL]
                                        ? nla_get_u32(tb[ZLIB_COMP_LEVEL])