[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251115224700.GA8885@quark>
Date: Sat, 15 Nov 2025 14:47:00 -0800
From: Eric Biggers <ebiggers@...nel.org>
To: linux-crypto@...r.kernel.org, Herbert Xu <herbert@...dor.apana.org.au>
Cc: Colin Ian King <coking@...dia.com>, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: Re: [PATCH 1/2] crypto: scatterwalk - Fix memcpy_sglist() to always
succeed
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
Powered by blists - more mailing lists