NULL call to _Workspace_Free() via _Objects_Extend_information at startup

Chris Johns chrisj at rtems.org
Tue Mar 1 00:16:36 UTC 2011


On 1/03/11 11:09 AM, Peter Dufault wrote:
>
> I haven't found "_Heap_Is_block_in_heap" in my tags yet, however, I see this as a tertiary operation: Block is in heap, block is not in heap, block is NULL, just like malloc() / free():  block == NULL should be silently ignored.  IMHO.

It will be ignored just like 'free'. We will just use the 'in heap call' 
to do this. Treating NULL as a special case has meant the bugs where 
hidden and if a non-NULL bad pointer is passed in no protection to the 
user is provided.

I suspect this shows up on some hardware and not other depending on 
hardware traps on various targets. On the sparc simulator I see the 
problem as the NULL under rolls to a high address and the MacOS build of 
gdb+sim catches the access. Joel does not see it on a Linux gdb+sim from 
the RPMs. I do not know why.

>
> Not that I've written anything that calls _Workspace_Free(), however, I routinely count on free(0) doing nothing and would probably like _Workspace_Free() to do the same thing.

The Object extended information code does count on this working.

Thanks for raising the PR.

Chris



More information about the users mailing list