lkml.org 
[lkml]   [2016]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] x86/boot: Rename overlapping memcpy() to memmove()
O> For example, this is what I've got currently:
>
> /* Detect and warn about potential overlaps. */
> void *memcpy(void *dest, const void *src, size_t n)
> {
> if (dest > src && dest - src < n)
> warn("Potentially unsafe overlapping memcpy detected!");
> return __memcpy(dest, src, n);
> }
>
> Does that seem okay? If so, I'll send the patch...

Probably useful for debug, but instead of relying on __memcpy
happening to handle overlaps - which isn't portable you could instead
debug all platforms by doing

if (...) {
warn(...)
memmove()
} else
__memcpy


Alan

\
 
 \ /
  Last update: 2016-04-28 19:01    [W:1.017 / U:0.568 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site