Skip to content

Commit 81c1a15

Browse files
committed
crypto: zstd - Fix compression bug caused by truncation
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 <han.xu@nxp.com> Fixes: f5ad93f ("crypto: zstd - convert to acomp") Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Reviewed-by: David Sterba <dsterba@suse.com> Tested-by: Han Xu <han.xu@nxp.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 166c83f commit 81c1a15

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)