public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Eugene Uriev <eugeneuriev@gmail.com>
To: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de, Eugene Uriev <eugeneuriev@gmail.com>
Subject: [PATCH 2/9] mcheck: Use memset/memcpy instead of MALLOC_ZERO/MALLOC_COPY for mcheck.
Date: Sun, 31 Mar 2024 23:03:20 +0300	[thread overview]
Message-ID: <20240331200327.29141-3-eugeneuriev@gmail.com> (raw)
In-Reply-To: <20240331200327.29141-1-eugeneuriev@gmail.com>

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>
---

 common/dlmalloc.c | 4 ++++
 1 file changed, 4 insertions(+)

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
-- 
2.25.1


  parent reply	other threads:[~2024-03-31 21:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-31 20:03 [PATCH 0/9] mcheck implementation for U-Boot Eugene Uriev
2024-03-31 20:03 ` [PATCH 1/9] mcheck: prepare +1 tier for mcheck-wrappers, in dl-*alloc commands Eugene Uriev
2024-03-31 20:03 ` Eugene Uriev [this message]
2024-03-31 20:03 ` [PATCH 3/9] mcheck: introduce essentials of mcheck Eugene Uriev
2024-03-31 20:03 ` [PATCH 4/9] mcheck: integrate mcheck into dlmalloc.c Eugene Uriev
2024-03-31 20:03 ` [PATCH 5/9] mcheck: support memalign Eugene Uriev
2024-03-31 20:03 ` [PATCH 6/9] mcheck: add pedantic mode support Eugene Uriev
2024-03-31 20:03 ` [PATCH 7/9] mcheck: introduce mcheck_on_ramrelocation(.) Eugene Uriev
2024-03-31 20:03 ` [PATCH 8/9] mcheck: add stats, add a comment with test results Eugene Uriev
2024-03-31 20:03 ` [PATCH 9/9] mcheck: let mcheck_abortfunc_t print the pointer Eugene Uriev
2024-04-13 16:18 ` [PATCH 0/9] mcheck implementation for U-Boot Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240331200327.29141-3-eugeneuriev@gmail.com \
    --to=eugeneuriev@gmail.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox