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

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

 



From: Linus Torvalds
> Sent: 08 September 2021 19:30
> 
> 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.

Even if the memcpy() 'mostly' copies upwards it may copy the last
8 bytes first and then copy the rest of the buffer in 8 byte chunks.

OTOH the change to libc that made it do backwards is just stupid.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux