Skip to content

Commit

Permalink
crypto: Use vzalloc
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Perches <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
JoePerches authored and herbertx committed Nov 27, 2010
1 parent 8ff5909 commit c848459
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions crypto/deflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions crypto/zlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit c848459

Please sign in to comment.