i386 | pc386 | startup | bspgetworkarea.c | incorrect value of work_area_size

Wendell Pereira da Silva wendell.silva at compsisnet.com.br
Wed Oct 24 18:44:23 UTC 2012


Before filing a bug report, I would like to share some thoughts about the following code of bspgetworkarea.c:

void bsp_get_work_area(

   void **work_area_start,

   uintptr_t *work_area_size,

   void **heap_start,

   uintptr_t *heap_size



(... removed for simplicity)

   *work_area_size = (uintptr_t) bsp_mem_size - (uintptr_t) rtemsWorkAreaStart;

(... removed for simplicity)

I've done an experiment by forcing my app to statically allocate a huge memory area producing a bss larger than the physical memory available on my board. I expected a message like "not enough memory for RTEMS workspace". But, this caused the rtemsWorkAreaStart be greater than bsp_mem_size, producing a work_area_size a very large value since it they are unsigned. The program, then, entered a very long loop while dirtying the memory (because I defined BSP_DIRT_MEMORY) back on bootcard.c.

My questions are:
 - Where is the good place the check if bsp_mem_size got less than rtemsWorkAreaStart?

My sugestion:
 - force work_are_size = 0, when bsp_mem_size is less than rtemsWorkAreaStart inside bsp_get_work_area().

More info:
Code verified: RTEMS 4.11 (4.10.99), RTEMS 4.10.2

Best regards for all.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20121024/850d35b4/attachment.html>

More information about the users mailing list