Add nokasan variants of __default_memcpy and default_memset. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- include/string.h | 4 ++++ lib/string.c | 28 +++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/include/string.h b/include/string.h index 120a613d46..727bc51934 100644 --- a/include/string.h +++ b/include/string.h @@ -7,6 +7,10 @@ int strtobool(const char *str, int *val); void *__default_memset(void *, int, __kernel_size_t); +void *__nokasan_default_memset(void *, int, __kernel_size_t); + void *__default_memcpy(void * dest,const void *src,size_t count); +void *__nokasan_default_memcpy(void * dest,const void *src,size_t count); + #endif /* __STRING_H */ diff --git a/lib/string.c b/lib/string.c index 7548fd3581..b950dbfd5f 100644 --- a/lib/string.c +++ b/lib/string.c @@ -491,7 +491,18 @@ char *strswab(const char *s) * * Do not use memset() to access IO space, use memset_io() instead. */ -void *__default_memset(void * s,int c,size_t count) +void *__default_memset(void * s, int c, size_t count) +{ + char *xs = (char *) s; + + while (count--) + *xs++ = c; + + return s; +} +EXPORT_SYMBOL(__default_memset); + +void __no_sanitize_address *__nokasan_default_memset(void * s, int c, size_t count) { char *xs = (char *) s; @@ -515,7 +526,18 @@ void *memset(void *s, int c, size_t count) __alias(__default_memset); * You should not use this function to access IO space, use memcpy_toio() * or memcpy_fromio() instead. */ -void *__default_memcpy(void * dest,const void *src,size_t count) +void *__default_memcpy(void * dest,const void *src, size_t count) +{ + char *tmp = (char *) dest, *s = (char *) src; + + while (count--) + *tmp++ = *s++; + + return dest; +} + +void __no_sanitize_address *__nokasan_default_memcpy(void * dest, + const void *src, size_t count) { char *tmp = (char *) dest, *s = (char *) src; @@ -524,7 +546,7 @@ void *__default_memcpy(void * dest,const void *src,size_t count) return dest; } -EXPORT_SYMBOL(memcpy); +EXPORT_SYMBOL(__default_memcpy); #ifndef __HAVE_ARCH_MEMCPY void *memcpy(void * dest, const void *src, size_t count) -- 2.28.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox