IMFS bug fix

Joel Sherrill joel.sherrill at OARcorp.com
Wed Nov 22 15:35:26 UTC 2000


Looks like a valid fix to me.  This also looks like the only path
through
that code that did NOT check the block pointer before using it. :(

Thanks.  I will make sure it makes the next snapshot.

Sturniolo Jose wrote:
> 
> I'm including a bug fix to the IMFS.
> How to replicate the bug:
>         Perform a put using FTP with a 1 Mbytes file.
>         Delete (from FTP client) the same file.
> 
> The file modified is memfile.c (libc), in function IMFS_memfile_remove()
> I added 2 lines checking the pointer. (see comment below)
> I tested using the MALLOC test routines in order to check if the memory is
> freeded and looks good.
> 
> Line 494:
>   if ( info->triply_indirect ) {
>     for ( i=0 ; i<IMFS_MEMFILE_BLOCK_SLOTS ; i++ ) {
>       p = (block_p *) info->triply_indirect[i];
>         if (!p)                         /* Check if we have a valid pointer
> */
>                 break;
>       for ( j=0 ; j<IMFS_MEMFILE_BLOCK_SLOTS ; j++ ) {
>         if ( p[j] ) {
>           memfile_free_blocks_in_table( (block_p **)&p[j], to_free);
>         }
>       }
>       memfile_free_blocks_in_table(
>         (block_p **)&info->triply_indirect[i], to_free );
>     }
>     memfile_free_blocks_in_table(
>         (block_p **)&info->triply_indirect, to_free );
>   }
> 
> Jose Sturniolo
> Product Engineering & Development Department
> Development & Implementations Division
> NEC Argentina S.A.

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the users mailing list