Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Suman Kumar Chakraborty <suman.kumar.chakraborty@intel.com>
Cc: linux-crypto@vger.kernel.org, qat-linux@intel.com,
	dsterba@suse.com, terrelln@fb.com, clabbe.montjoie@gmail.com
Subject: Re: [v2] crypto: zstd - convert to acomp
Date: Wed, 21 May 2025 16:03:31 +0800	[thread overview]
Message-ID: <aC2I0_F2BJbexte4@gondor.apana.org.au> (raw)
In-Reply-To: <20250521064111.3339510-1-suman.kumar.chakraborty@intel.com>

On Wed, May 21, 2025 at 07:41:11AM +0100, Suman Kumar Chakraborty wrote:
>
> +	if ((sg_nents(req->src) == 1) && (sg_nents(req->dst) == 1)) {
> +		ret = zstd_compress_one(req, ctx, &total_out);
> +		goto out;

This isn't right.  Even if the SG list is a singleton, it could
consist of multiple pages in highmem.

What's worse, if src and dst are in fact linear, then you're
dereferencing bogus pointers.

Just get rid of this optimisation unless you've got numbers
proving that it makes a difference.

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

  reply	other threads:[~2025-05-21  8:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-21  6:41 [v2] crypto: zstd - convert to acomp Suman Kumar Chakraborty
2025-05-21  8:03 ` Herbert Xu [this message]
2025-05-22  9:05   ` Cabiddu, Giovanni
2025-05-22  9:07     ` Herbert Xu
2025-05-26  9:48       ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aC2I0_F2BJbexte4@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=clabbe.montjoie@gmail.com \
    --cc=dsterba@suse.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=qat-linux@intel.com \
    --cc=suman.kumar.chakraborty@intel.com \
    --cc=terrelln@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox