From: Eugene Uriev Date: Sun, 31 Mar 2024 20:03:20 +0000 (+0300) Subject: mcheck: Use memset/memcpy instead of MALLOC_ZERO/MALLOC_COPY for mcheck. X-Git-Url: http://git.dujemihanovic.xyz/%22http:/www.sics.se/static/git-logo.png?a=commitdiff_plain;h=dfba071ddc3e609e61770b34ab0115fbce05edb2;p=u-boot.git mcheck: Use memset/memcpy instead of MALLOC_ZERO/MALLOC_COPY for mcheck. These fast helpers sometimes breach mem-chunk boundaries. Thus they trigger mcheck alarm. Standard ones are accurate though. Signed-off-by: Eugene Uriev --- diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 40acd3dfa5..0813e7e8b1 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -34,6 +34,10 @@ DECLARE_GLOBAL_DATA_PTR; #ifdef MCHECK_HEAP_PROTECTION #define STATIC_IF_MCHECK static + #undef MALLOC_COPY + #undef MALLOC_ZERO +static inline void MALLOC_ZERO(void *p, size_t sz) { memset(p, 0, sz); } +static inline void MALLOC_COPY(void *dest, const void *src, size_t sz) { memcpy(dest, src, sz); } #else #define STATIC_IF_MCHECK #define mALLOc_impl mALLOc