diff options
| author | bernard.xiong <[email protected]> | 2010-07-22 02:54:19 +0000 |
|---|---|---|
| committer | bernard.xiong <[email protected]> | 2010-07-22 02:54:19 +0000 |
| commit | 0a64bac9d9a1d0b522e46ea58e8a07c59e567c6a (patch) | |
| tree | d0719666e8a0e6821118f267b9db0217c3fc1333 /src/slab.c | |
| parent | f834265044a0bcd6f0c7099de96e38e47324f28a (diff) | |
apply kuronca patch for heap initialization check.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@811 bbd45198-f89e-11dd-88c7-29a3b14d5316
Diffstat (limited to 'src/slab.c')
| -rw-r--r-- | src/slab.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/slab.c b/src/slab.c index 216ee19500..dc904230f2 100644 --- a/src/slab.c +++ b/src/slab.c @@ -329,6 +329,11 @@ void rt_system_heap_init(void *begin_addr, void* end_addr) heap_start = RT_ALIGN((rt_uint32_t)begin_addr, RT_MM_PAGE_SIZE); heap_end = RT_ALIGN_DOWN((rt_uint32_t)end_addr, RT_MM_PAGE_SIZE); + if(heap_start >= heap_end) { + rt_kprintf("rt_system_heap_init, error begin address 0x%x, and end address 0x%x\n", (rt_uint32_t)begin_addr, (rt_uint32_t)end_addr); + return; + } + limsize = heap_end - heap_start; npages = limsize / RT_MM_PAGE_SIZE; |
