mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 14:19:16 +00:00
crypto: Use vzalloc
Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
8ff590903d
commit
c8484594ae
2 changed files with 2 additions and 4 deletions
|
@ -48,12 +48,11 @@ static int deflate_comp_init(struct deflate_ctx *ctx)
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct z_stream_s *stream = &ctx->comp_stream;
|
struct z_stream_s *stream = &ctx->comp_stream;
|
||||||
|
|
||||||
stream->workspace = vmalloc(zlib_deflate_workspacesize());
|
stream->workspace = vzalloc(zlib_deflate_workspacesize());
|
||||||
if (!stream->workspace) {
|
if (!stream->workspace) {
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
memset(stream->workspace, 0, zlib_deflate_workspacesize());
|
|
||||||
ret = zlib_deflateInit2(stream, DEFLATE_DEF_LEVEL, Z_DEFLATED,
|
ret = zlib_deflateInit2(stream, DEFLATE_DEF_LEVEL, Z_DEFLATED,
|
||||||
-DEFLATE_DEF_WINBITS, DEFLATE_DEF_MEMLEVEL,
|
-DEFLATE_DEF_WINBITS, DEFLATE_DEF_MEMLEVEL,
|
||||||
Z_DEFAULT_STRATEGY);
|
Z_DEFAULT_STRATEGY);
|
||||||
|
|
|
@ -95,11 +95,10 @@ static int zlib_compress_setup(struct crypto_pcomp *tfm, void *params,
|
||||||
zlib_comp_exit(ctx);
|
zlib_comp_exit(ctx);
|
||||||
|
|
||||||
workspacesize = zlib_deflate_workspacesize();
|
workspacesize = zlib_deflate_workspacesize();
|
||||||
stream->workspace = vmalloc(workspacesize);
|
stream->workspace = vzalloc(workspacesize);
|
||||||
if (!stream->workspace)
|
if (!stream->workspace)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memset(stream->workspace, 0, workspacesize);
|
|
||||||
ret = zlib_deflateInit2(stream,
|
ret = zlib_deflateInit2(stream,
|
||||||
tb[ZLIB_COMP_LEVEL]
|
tb[ZLIB_COMP_LEVEL]
|
||||||
? nla_get_u32(tb[ZLIB_COMP_LEVEL])
|
? nla_get_u32(tb[ZLIB_COMP_LEVEL])
|
||||||
|
|
Loading…
Reference in a new issue