Skip to content

Commit 15ea288

Browse files
herbertxgregkh
authored andcommitted
crypto: zstd - Fix compression bug caused by truncation
commit 81c1a15eb4a273eabedfcc28eb6afa4b50cb8a46 upstream. Use size_t for the return value of zstd_compress_cctx as otherwise negative errors will be truncated to a positive value. Reported-by: Han Xu <[email protected]> Fixes: f5ad93f ("crypto: zstd - convert to acomp") Signed-off-by: Herbert Xu <[email protected]> Reviewed-by: David Sterba <[email protected]> Tested-by: Han Xu <[email protected]> Signed-off-by: Herbert Xu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 75fcc07 commit 15ea288

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crypto/zstd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void zstd_exit(struct crypto_acomp *acomp_tfm)
8383
static int zstd_compress_one(struct acomp_req *req, struct zstd_ctx *ctx,
8484
const void *src, void *dst, unsigned int *dlen)
8585
{
86-
unsigned int out_len;
86+
size_t out_len;
8787

8888
ctx->cctx = zstd_init_cctx(ctx->wksp, ctx->wksp_size);
8989
if (!ctx->cctx)

0 commit comments

Comments
 (0)