summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/heapwalk.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-06-08 22:50:27 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-06-08 22:50:27 +0000
commite050d9ae5a38c56dc92eda265abfe1fc046969fd (patch)
tree6aad686334f8318ef823561bae99d360cedc0f18 /cpukit/score/src/heapwalk.c
parent2009-06-08 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-e050d9ae5a38c56dc92eda265abfe1fc046969fd.tar.bz2
2009-06-08 Joel Sherrill <joel.sherrill@OARcorp.com>
* score/src/heapwalk.c: Verify addresses are aligned.
Diffstat (limited to 'cpukit/score/src/heapwalk.c')
-rw-r--r--cpukit/score/src/heapwalk.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/cpukit/score/src/heapwalk.c b/cpukit/score/src/heapwalk.c
index 3505676f4c..e3b487777b 100644
--- a/cpukit/score/src/heapwalk.c
+++ b/cpukit/score/src/heapwalk.c
@@ -18,6 +18,7 @@
#include <stdlib.h> /* abort */
#include <rtems/system.h>
+#include <rtems/score/address.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/heap.h>
#include <rtems/score/interr.h>
@@ -100,13 +101,13 @@ bool _Heap_Walk(
printk(" (prev_size) %d", the_block->prev_size);
}
- if (!_Heap_Is_block_in(the_heap, next_block)) {
- if (do_dump) printk("\n");
- printk("PASS: %d !block %p is out of heap\n", source, next_block);
+
+ if (!_Addresses_Is_aligned(next_block) ) {
+ printk("PASS: %d next_block %p is not aligned\n", source, next_block);
error = 1;
break;
}
-
+
if (!_Heap_Is_prev_used(next_block)) {
if (do_dump)
printk( " prev %p next %p", the_block->prev, the_block->next);
@@ -123,9 +124,27 @@ bool _Heap_Walk(
{ /* Check if 'the_block' is in the free block list */
Heap_Block* block = _Heap_First(the_heap);
- while(block != the_block && block != tail)
+ if (!_Addresses_Is_aligned(block) ) {
+ printk(
+ "PASS: %d first free block %p is not aligned\n", source, block);
+ error = 1;
+ break;
+ }
+ while(block != the_block && block != tail) {
+ if (!_Addresses_Is_aligned(block) ) {
+ printk(
+ "PASS: %d a free block %p is not aligned\n", source, block);
+ error = 1;
+ break;
+ }
+ if (!_Heap_Is_block_in(the_heap, block)) {
+ printk("PASS: %d a free block %p is not in heap\n", source, block);
+ error = 1;
+ break;
+ }
block = block->next;
- if(block != the_block) {
+ }
+ if (block != the_block) {
if (do_dump || error) printk("\n");
printk("PASS: %d !the_block not in the free list", source);
error = 1;