diff options
author | Eugene Uriev <eugeneuriev@gmail.com> | 2024-03-31 23:03:24 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2024-04-12 16:23:06 -0600 |
commit | 18c1bfafe0ccdd3229d91bbb07ed942e9f233f93 (patch) | |
tree | 2c626c8976822e5abd997091fb97a541ea176745 /common/dlmalloc.c | |
parent | ae838768d79cbb834c4a8a5f4810df373e58b622 (diff) | |
download | u-boot-18c1bfafe0ccdd3229d91bbb07ed942e9f233f93.zip u-boot-18c1bfafe0ccdd3229d91bbb07ed942e9f233f93.tar.gz u-boot-18c1bfafe0ccdd3229d91bbb07ed942e9f233f93.tar.bz2 |
mcheck: add pedantic mode support
The pedantic mode is run-time contolled, so
appropriate registry take place everytime.
Maybe it's worth to use compile-time control only.
So, the registry could be optimized out by an #ifdef.
Signed-off-by: Eugene Uriev <eugeneuriev@gmail.com>
Diffstat (limited to 'common/dlmalloc.c')
-rw-r--r-- | common/dlmalloc.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/common/dlmalloc.c b/common/dlmalloc.c index 73c04af..a061621 100644 --- a/common/dlmalloc.c +++ b/common/dlmalloc.c @@ -2233,6 +2233,7 @@ void cfree(mem) Void_t *mem; Void_t *mALLOc(size_t bytes) { + mcheck_pedantic_prehook(); size_t fullsz = mcheck_alloc_prehook(bytes); void *p = mALLOc_impl(fullsz); @@ -2245,6 +2246,7 @@ void fREe(Void_t *mem) { fREe_impl(mcheck_free_prehook(mem)); } Void_t *rEALLOc(Void_t *oldmem, size_t bytes) { + mcheck_pedantic_prehook(); if (bytes == 0) { if (oldmem) fREe(oldmem); @@ -2265,6 +2267,7 @@ Void_t *rEALLOc(Void_t *oldmem, size_t bytes) Void_t *mEMALIGn(size_t alignment, size_t bytes) { + mcheck_pedantic_prehook(); size_t fullsz = mcheck_memalign_prehook(alignment, bytes); void *p = mEMALIGn_impl(alignment, fullsz); @@ -2277,6 +2280,7 @@ Void_t *mEMALIGn(size_t alignment, size_t bytes) Void_t *cALLOc(size_t n, size_t elem_size) { + mcheck_pedantic_prehook(); // NB: here is no overflow check. size_t fullsz = mcheck_alloc_prehook(n * elem_size); void *p = cALLOc_impl(1, fullsz); @@ -2287,12 +2291,20 @@ Void_t *cALLOc(size_t n, size_t elem_size) } // mcheck API { +int mcheck_pedantic(mcheck_abortfunc_t f) +{ + mcheck_initialize(f, 1); + return 0; +} + int mcheck(mcheck_abortfunc_t f) { mcheck_initialize(f, 0); return 0; } +void mcheck_check_all(void) { mcheck_pedantic_check(); } + enum mcheck_status mprobe(void *__ptr) { return mcheck_mprobe(__ptr); } // mcheck API } #endif |