From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org, Herbert Xu <herbert@gondor.apana.org.au>
Cc: Colin Ian King <coking@nvidia.com>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/2] crypto: scatterwalk - Fix memcpy_sglist() to always succeed
Date: Sat, 15 Nov 2025 14:47:00 -0800 [thread overview]
Message-ID: <20251115224700.GA8885@quark> (raw)
In-Reply-To: <20251114225851.324143-2-ebiggers@kernel.org>
On Fri, Nov 14, 2025 at 02:58:50PM -0800, Eric Biggers wrote:
> +/**
> + * memcpy_sglist() - Copy data from one scatterlist to another
> + * @dst: The destination scatterlist. Can be NULL if @nbytes == 0.
> + * @src: The source scatterlist. Can be NULL if @nbytes == 0.
> + * @nbytes: Number of bytes to copy
> + *
> + * The scatterlists can overlap. Hence this really acts like memmove(), not
> + * memcpy().
> + *
> + * Context: Any context
> + */
[...]
> + if (src_virt != dst_virt) {
> + memmove(dst_virt, src_virt, len);
> + if (ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE)
> + __scatterwalk_flush_dcache_pages(
> + dst_page, dst_offset, len);
> + }
I realized that this doesn't correctly handle arbitrary overlaps in the
case where there are multiple copy steps. So, my idea to make this
function more robust by allowing arbitrary overlaps won't easily work.
I'll send a revised version that only claims to support exact overlaps,
which is consistent with the current code.
- Eric
next prev parent reply other threads:[~2025-11-15 22:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-14 22:58 [PATCH 0/2] crypto: Fix memcpy_sglist() Eric Biggers
2025-11-14 22:58 ` [PATCH 1/2] crypto: scatterwalk - Fix memcpy_sglist() to always succeed Eric Biggers
2025-11-15 22:47 ` Eric Biggers [this message]
2025-11-14 22:58 ` [PATCH 2/2] Revert "crypto: scatterwalk - Move skcipher walk and use it for memcpy_sglist" Eric Biggers
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=20251115224700.GA8885@quark \
--to=ebiggers@kernel.org \
--cc=coking@nvidia.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).