change log for rtems (2010-04-28)

Chris Johns chrisj at rtems.org
Wed Apr 28 22:20:25 UTC 2010


On 29/04/2010 1:11 AM, rtems-vc at rtems.org wrote:
>
> +  if ( !pathname )
> +    rtems_set_errno_and_return_minus_one( EFAULT );
> +

I think this change is hiding a deeper problem we need to fix. I think 
this change should be reverted so the test that exposes it can test the 
real solution.

>     /*
>      *  Get the node where we wish to go.
>      */
> -
>     result = rtems_filesystem_evaluate_path(
>       pathname, strlen( pathname ), RTEMS_LIBIO_PERMS_SEARCH,&loc, true );
>     if ( result != 0 )

I changed this call to pass the length of a string which means the test 
in rtems_filesystem_evaluate_path call for pathname == NULL can never 
happen because the strlen call would fail first. My change did not deal 
with this case.

A couple of solutions are:

1. Add a rtems_filesystem_stlen call that checks for NULL and update
    all call sites.
2. Add a rtems_filesystem_evaluate_path_len (or something) and update
    the location of those places that need the length.
3. Any others ?

The change was made to remove the endless need for code in file systems 
or libc level code from having to copy a string to new memory to make 
the call. It is common in the code to iterate down a path by taking just 
a piece at a time. The copy meant heap allocations all for a small 
section of a string when looking up a path.

Chris



More information about the vc mailing list