Re: [PATCH v6] crypto: zstd - convert to acomp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 04, 2025 at 05:25:38AM +0100, Suman Kumar Chakraborty wrote:
>
> +	u8 wksp[0] __attribute__((aligned(8)));

Please use __aligned.

> -static int __zstd_compress(const u8 *src, unsigned int slen,
> -			   u8 *dst, unsigned int *dlen, void *ctx)
> +static int zstd_compress_one(struct acomp_req *req, struct zstd_ctx *ctx, unsigned int *dlen)
>  {
> -	size_t out_len;
> -	struct zstd_ctx *zctx = ctx;
> -	const zstd_parameters params = zstd_params();
> +	unsigned int out_len;
>  
> -	out_len = zstd_compress_cctx(zctx->cctx, dst, *dlen, src, slen, &params);
> +	ctx->cctx = zstd_init_cctx(ctx->wksp, ctx->wksp_size);
> +	if (!ctx->cctx)
> +		return -EINVAL;
> +
> +	out_len = zstd_compress_cctx(ctx->cctx, sg_virt(req->dst),
> +				     req->dlen, sg_virt(req->src),
> +				     req->slen, &ctx->params);

Even if the SG is linear, it may not have been mapped so you
can't just do sg_virt.  Just use the mapped address from the
walk object.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux