| Message ID | 20251210000737.180797-35-sjg@u-boot.org |
|---|---|
| State | New |
| Headers |
Return-Path: <concept-bounces+u-boot-concept=u-boot.org@u-boot.org> X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765325427; bh=YsAdI3Z95Eco433L3ZIuUFc8s03i00cE9qqJMpjRB5s=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=s7tiHyz3al4gmUm6QezQgNbsIEmETamlcWTQmEtHBlhaH2g1b9jtUhdwWzzfFeqLE IZsSnZRbDT6xbxDQHqCV5iGNLDMIuI0EPMoFr704j4oSeKQ17XukGfJxSKLp97OfAt QdNuWpxSZ2JpHqtdhdUOFo7UgHL056SNIwDmFEzsqM6lbGftNsamrgpBvQwyHO27KA 4GuMZ1SW19BHLLmjcYpcKVmpm7nyyUhUMEM1dh7aOVnNqkiCTrbGOdDA2hdNUr/+Th AQ2s+lveEzMfcT1b6vtaFxC+rfptQ5BKRX9SmtpdYHMKZjP6Weq0FyaDEkwgOgQmdl bcMd6097fHYPQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2F86268A5D for <u-boot-concept@u-boot.org>; Tue, 9 Dec 2025 17:10:27 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id NbYaDyyHHoi1 for <u-boot-concept@u-boot.org>; Tue, 9 Dec 2025 17:10:27 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765325426; bh=YsAdI3Z95Eco433L3ZIuUFc8s03i00cE9qqJMpjRB5s=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=elAc6anjwBeF/MwFbq2fmoSLNwduc/L2eng2LYl3yw2p9Qd0xgsLLXJJh1R3svdbg N9NcffPngQRBAAKopd3qDRIsf+BFfCZBazvktc6e2wwSCuZUJa3I+GCM1xw8fPUWaj e8ziM4mA2uqa4pc2PtOSON6SQmekuYx9BSCc7Yt3aT/KJdwujo+6sq9vUGnv+Zt+LS Jpr+oR3dbprn3ti6bBDhQyJyFekbjwSmcp2solo6FWKWdhrCpz9Fkjx2clhacezrsp nfDtg/1HEbvhM4LWfr1ADErjm1hF2gMVFDtmecvFq9qSpbTNTtFBlWARyUH5pL004x mBks5lI5D/dnw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7E8B568A44 for <u-boot-concept@u-boot.org>; Tue, 9 Dec 2025 17:10:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765325424; bh=ppjB/IOAy0X5+Jx6XzZF965nmzkDu0sz+09pyiZtMQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=exTUN1zISGpp9xXsdf/Xe0xZ29MJdE0suBrAdcp8qRAZ4aYJmBil94eDQTMKqvUfH M8fLKl7w1xv9g0HYZFxybUN4DJ/XtsGXJR94xrFuhmQ7ZQfs6nYewhhwnrJQtYC5KK r02+AF5TkDEfsOAclBskGUukpDkEUxGKlOWFJGgw8P9kWqKU9o+mYcve7WHtYwO3yA xtLu6sN78pAyQBm/Dx3GLoHxKQAByjp8vJkDKUFwperogbp2hUtFDwsjvtuYUl5hsE Ng62Ig7o3klg8xcAzSXovt3mPXb/BpdCMjtDHUHYf+wDmvC3X9yFP/f4hGHDAtdkJO ji+DmewW2n9mQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 23E356895B; Tue, 9 Dec 2025 17:10:24 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id FSme5_XXyAoj; Tue, 9 Dec 2025 17:10:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1765325423; bh=9jbEjNQo46/7HDNtYvj04vhYWD8hdmj8EjmPPHY8YvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZEExKwzFmiD9qFzdOoxWIGSjd/xoS89oI9L4Dde1hKYeAsMBcP6jYnEA117++6GGt J5hIPv6eZAaYrvPX0HpRqDLKMbjIVh25vDgH4zoqxr5k5IcrioA1W9aB33BrG68wSw Pm/o3p/s0PVlz1oiGVfM5gP9fu1KOU1sdbaOmfTk5v4AsVuPAqxvbiZUim5aHYjVgj VV/NIsyCYlkhAL9aJ+/GpPOtFgOdroIpl7NKmWoSzypid3ervd45oDjF5rlguwePXL ojQk1QQJrkiUT1Dw1fmtk15OV5np2fVwQbzhQ3zQ7KF4BFq5m223mYXTLIsb+tGI7W V2iBmA5EaUmuw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4EDAC689EA; Tue, 9 Dec 2025 17:10:23 -0700 (MST) From: Simon Glass <sjg@u-boot.org> To: U-Boot Concept <concept@u-boot.org> Date: Tue, 9 Dec 2025 17:07:25 -0700 Message-ID: <20251210000737.180797-35-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251210000737.180797-1-sjg@u-boot.org> References: <20251210000737.180797-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 6FCO7XDAGKYQP7Q26YOFOS4HGULBAHEW X-Message-ID-Hash: 6FCO7XDAGKYQP7Q26YOFOS4HGULBAHEW X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt <xypron.glpk@gmx.de>, Simon Glass <simon.glass@canonical.com>, Claude <noreply@anthropic.com> X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 34/35] malloc: Print mcheck registry-overflow message only once List-Id: Discussion and patches related to U-Boot Concept <concept.u-boot.org> Archived-At: <https://lists.u-boot.org/archives/list/concept@u-boot.org/message/6FCO7XDAGKYQP7Q26YOFOS4HGULBAHEW/> List-Archive: <https://lists.u-boot.org/archives/list/concept@u-boot.org/> List-Help: <mailto:concept-request@u-boot.org?subject=help> List-Owner: <mailto:concept-owner@u-boot.org> List-Post: <mailto:concept@u-boot.org> List-Subscribe: <mailto:concept-join@u-boot.org> List-Unsubscribe: <mailto:concept-leave@u-boot.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit |
| Series |
malloc: Add heap debugging commands and mcheck caller tracking
|
|
Commit Message
Simon Glass
Dec. 10, 2025, 12:07 a.m. UTC
From: Simon Glass <simon.glass@canonical.com> Use a static bool flag to ensure the overflow warning is printed only once, avoiding repeated messages when the registry is full. Make sure to set the flag before calling printf(), which can itself do allocations with sandbox / Truetype. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <simon.glass@canonical.com> --- common/mcheck_core.inc.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/common/mcheck_core.inc.h b/common/mcheck_core.inc.h index 63dbeaa5f56..598a5d018ab 100644 --- a/common/mcheck_core.inc.h +++ b/common/mcheck_core.inc.h @@ -201,6 +201,7 @@ static void *mcheck_allocated_helper(void *altoghether_ptr, size_t customer_sz, size_t alignment, int clean_content, const char *caller) { + static bool overflow_msg_shown; const size_t slop = alignment ? mcheck_evaluate_memalign_prefix_size(alignment) - sizeof(struct mcheck_hdr) : 0; struct mcheck_hdr *hdr = (struct mcheck_hdr *)((char *)altoghether_ptr + slop); @@ -239,10 +240,10 @@ static void *mcheck_allocated_helper(void *altoghether_ptr, size_t customer_sz, return payload; // normal end } - static char *overflow_msg = "\n\n\nERROR: mcheck registry overflow, pedantic check would be incomplete!!\n\n\n\n"; - - printf("%s", overflow_msg); - overflow_msg = "(mcheck registry full)"; + if (!overflow_msg_shown) { + overflow_msg_shown = true; + printf("\n\nERROR: mcheck registry overflow, pedantic check would be incomplete!\n\n"); + } return payload; }