lkml.org 
[lkml]   [2008]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [git pull] "big box" x86 changes, boot protocol
Andrew Morton wrote:
>> + memcpy(&early_res[i], &early_res[i + 1],
>> + (j - 1 - i) * sizeof(struct early_res));
>>
>
> nit: memcpy() shouldn't be used for overlapping copies. It happens to be
> OK (for dst<src) in the kernel implementations. We hope.
>

Definitely shouldn't be assumed. At one point in the distant past I had
a ppc memcpy which would clobber a destination cacheline before reading
the source, so source and dest within a cacheline's distance would be
trouble, regardless of the direction. Arch-specific code which knows
about the arch-specific details of memcpy might be safer, I guess, but
its still fairly brittle.

J


\
 
 \ /
  Last update: 2008-04-27 01:41    [from the cache]
©2003-2011 Jasper Spaans