Re: [patch 102/147] lib/string: optimized memmove

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

 



On Tue, Sep 7, 2021 at 7:58 PM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> When the destination buffer is before the source one, or when the buffers
> doesn't overlap, it's safe to use memcpy() instead, which is optimized to
> use a bigger data size possible.

This one is actively buggy.

It depends on the possibly incorrect assumption that memcpy() always
copies upwards.

That is admittedly commonly true, but it's not something we can depend
on. Not even when the memcpy() implementation in the very same file
ends up doing so - because architectures can and should replace that
function with their own ones, and we have that __HAVE_ARCH_MEMCPY for
exactly that case.

Like 101/147, all reasonable architectures end up having their own
implementation anyway, but the immediate reason I'm dropping this
patch is that it's literally incorrect.

             Linus




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux