public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* dlmalloc assert check for the size of the arena
@ 2010-06-15 10:10 Edgar Grimberg
  0 siblings, 0 replies; only message in thread
From: Edgar Grimberg @ 2010-06-15 10:10 UTC (permalink / raw)
  To: ecos-patches

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-06-15 10:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-15 10:10 dlmalloc assert check for the size of the arena Edgar Grimberg

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