public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
From: Edgar Grimberg <edgar.grimberg@zylin.com>
To: ecos-patches@ecos.sourceware.org
Subject: dlmalloc assert check for the size of the arena
Date: Tue, 15 Jun 2010 10:10:00 -0000	[thread overview]
Message-ID: <AANLkTiky5FCr4P7KhUUe_KG4Gq9SgBFDleIe7VaVj_l6@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

Hi,

When modifying the linker script to adjust the location of RAM, it is
easy to forget to change the size of the heap in the eCos memory
layout file. This value is being passed to the memory allocator. If
the size if negative, the dlmalloc doesn't complain.
The attached patch checks the size on an assert.

Regards,
Edgar

-- 
Edgar Grimberg
System Developer
Zylin AS

ZY1000 JTAG Debugger http://www.zylin.com/zy1000.html
Phone: (+47) 51 63 25 00

[-- Attachment #2: dlmalloc.patch --]
[-- Type: text/x-patch, Size: 1384 bytes --]

# HG changeset patch
# User Edgar Grimberg <edgar.grimberg@zylin.com>
# Date 1276596038 -7200
# Node ID 831d5e603f1f9037db95bbf0362cfd224eb2e170
# Parent  eb303059b6e55fe739866837ef0e6c970873b45e
Add an assert to check for invalid size of the arena.

diff -r eb303059b6e5 -r 831d5e603f1f packages/services/memalloc/common/current/ChangeLog
--- a/packages/services/memalloc/common/current/ChangeLog	Thu Jun 10 20:46:18 2010 +0000
+++ b/packages/services/memalloc/common/current/ChangeLog	Tue Jun 15 12:00:38 2010 +0200
@@ -1,3 +1,8 @@
+2010-06-15 Edgar Grimberg <edgar.grimberg@zylin.com>
+
+	* src/dlmalloc.cxx Cyg_Mempool_dlmalloc_Implementation:
+	Add an assert to check for invalid size of the arena.
+
 2009-09-01  Bart Veer  <bartv@ecoscentric.com>
 
 	* src/heapgen.tcl (tcl_path): use the makefile's HOST instead of
diff -r eb303059b6e5 -r 831d5e603f1f packages/services/memalloc/common/current/src/dlmalloc.cxx
--- a/packages/services/memalloc/common/current/src/dlmalloc.cxx	Thu Jun 10 20:46:18 2010 +0000
+++ b/packages/services/memalloc/common/current/src/dlmalloc.cxx	Tue Jun 15 12:00:38 2010 +0200
@@ -948,6 +948,8 @@
                                             cyg_uint8 *base, cyg_int32 size,
                                             CYG_ADDRWORD /* argthru */ )
 {
+	CYG_ASSERT(size > 0, "Invalid arena size." );
+
     arenabase = base;
     arenasize = size;
 

                 reply	other threads:[~2010-06-15 10:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=AANLkTiky5FCr4P7KhUUe_KG4Gq9SgBFDleIe7VaVj_l6@mail.gmail.com \
    --to=edgar.grimberg@zylin.com \
    --cc=ecos-patches@ecos.sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).