Commit 81c1a15e authored by Herbert Xu's avatar Herbert Xu
Browse files

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: default avatarHan Xu <han.xu@nxp.com>
Fixes: f5ad93ff ("crypto: zstd - convert to acomp")
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Tested-by: default avatarHan Xu <han.xu@nxp.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 166c83f7
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ static void zstd_exit(struct crypto_acomp *acomp_tfm)
static int zstd_compress_one(struct acomp_req *req, struct zstd_ctx *ctx,
			     const void *src, void *dst, unsigned int *dlen)
{
	unsigned int out_len;
	size_t out_len;

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