aboutsummaryrefslogtreecommitdiffstats
path: root/common/dlmalloc.c
diff options
context:
space:
mode:
authorEugene Uriev <eugeneuriev@gmail.com>2024-03-31 23:03:20 +0300
committerTom Rini <trini@konsulko.com>2024-04-12 16:23:06 -0600
commitdfba071ddc3e609e61770b34ab0115fbce05edb2 (patch)
tree8a1dc4ae9d6882ff74dd0729d2e78a76acc1bb74 /common/dlmalloc.c
parentc82ff481159d2cf7e637c709df84883e09bba588 (diff)
downloadu-boot-dfba071ddc3e609e61770b34ab0115fbce05edb2.tar.gz
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 <eugeneuriev@gmail.com>
Diffstat (limited to 'common/dlmalloc.c')
-rw-r--r--common/dlmalloc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index 40acd3dfa51..0813e7e8b10 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