Changeset 9ba0e55 in rtems


Ignore:
Timestamp:
Jan 18, 2010, 11:39:31 PM (11 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 5, master
Children:
ad7824bc
Parents:
2bac9489
Message:

2010-01-18 Joel Sherrill <joel.sherrill@…>

Coverity Id 19
Coverity Id 20
Coverity Id 21

  • libfs/src/imfs/imfs_link.c, libfs/src/imfs/imfs_load_tar.c, libfs/src/imfs/imfs_mknod.c: Add comment to explain allocation is for life of file, not scope of method.
Location:
cpukit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r2bac9489 r9ba0e55  
     12010-01-18      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        Coverity Id 19
     4        Coverity Id 20
     5        Coverity Id 21
     6        * libfs/src/imfs/imfs_link.c, libfs/src/imfs/imfs_load_tar.c,
     7        libfs/src/imfs/imfs_mknod.c: Add comment to explain allocation is
     8        for life of file, not scope of method.
     9
    1102010-01-18      Joel Sherrill <joel.sherrill@oarcorp.com>
    211
  • cpukit/libfs/src/imfs/imfs_link.c

    r2bac9489 r9ba0e55  
    66 *  to_loc.
    77 *
    8  *  COPYRIGHT (c) 1989-1999.
     8 *  COPYRIGHT (c) 1989-2010.
    99 *  On-Line Applications Research Corporation (OAR).
    1010 *
     
    5252  /*
    5353   *  Create a new link node.
     54   *
     55   * NOTE: Coverity thinks this is a resource leak since a node
     56   *       is created but never deleted.  The scope of the allocation
     57   *       is that of a file -- not this method.  Coverity Id 19.
    5458   */
    5559
  • cpukit/libfs/src/imfs/imfs_load_tar.c

    r2bac9489 r9ba0e55  
    11/*
     2 *  COPYRIGHT (c) 1989-2010.
     3 *  On-Line Applications Research Corporation (OAR).
     4 *
     5 *  The license and distribution terms for this file may be
     6 *  found in the file LICENSE in this distribution or at
     7 *  http://www.rtems.com/license/LICENSE.
     8 *
    29 * $Id$
    310 */
     
    714#endif
    815
    9 /**************************************************************************
     16/*
    1017 * This file implements the "mount" procedure for tar-based IMFS
    1118 * extensions.  The TAR is not actually mounted under the IMFS.
     
    1320 * File entries are created as IMFS_LINEAR_FILE nodes with their nods
    1421 * pointing to addresses in the TAR image.
    15  *************************************************************************/
     22 */
    1623
    1724#include <sys/types.h>
     
    2734#include <rtems/tar.h>
    2835
    29 /**************************************************************************
     36/*
    3037 * TAR file format:
    3138 *
     
    5562 *   for(i = 0; i < 512; i++)
    5663 *       sum += 0xFF & header[i];
    57  *************************************************************************/
     64 */
    5865
    5966#define MAX_NAME_FIELD_SIZE      99
     
    6168#define MIN(a,b)   ((a)>(b)?(b):(a))
    6269
    63 /**************************************************************************
     70/*
    6471 * rtems_tarfs_load
    6572 *
     
    7178 *  - For files, we make our own calls to IMFS eval_for_make and
    7279 *    create_node.
    73  *************************************************************************/
    74 int
    75 rtems_tarfs_load(
     80 */
     81int rtems_tarfs_load(
    7682  char *mountpoint,
    7783  uint8_t *tar_image,
     
    99105
    100106   if (root_loc.ops != &IMFS_ops)
    101       return(-1);
     107      return -1;
    102108
    103    /***********************************************************************
     109   /*
    104110    * Create an IMFS node structure pointing to tar image memory.
    105     **********************************************************************/
     111    */
    106112   offset = 0;
    107    while (1)
    108    {
     113   while (1) {
    109114      if (offset + 512 > tar_size)
    110115         break;
    111116
    112       /******************************************************************
     117      /*
    113118       * Read a header.
    114        ******************************************************************/
     119       */
    115120      hdr_ptr = (char *) &tar_image[offset];
    116121      offset += 512;
     
    129134         break;
    130135
    131       /******************************************************************
     136      /*
    132137       * Generate an IMFS node depending on the file type.
    133138       * - For directories, just create directories as usual.  IMFS
    134139       *   will take care of the rest.
    135140       * - For files, create a file node with special tarfs properties.
    136        *****************************************************************/
    137       if (linkflag == DIRTYPE)
    138       {
     141       */
     142      if (linkflag == DIRTYPE) {
    139143         strcpy(full_filename, mountpoint);
    140144         if (full_filename[strlen(full_filename)-1] != '/')
     
    143147         mkdir(full_filename, S_IRWXU | S_IRWXG | S_IRWXO);
    144148      }
    145       /******************************************************************
     149      /*
    146150       * Create a LINEAR_FILE node
    147        *****************************************************************/
    148       else if (linkflag == REGTYPE)
    149       {
     151       *
     152       * NOTE: Coverity thinks this is a resource leak since a node
     153       *       is created but never deleted.  The scope of the allocation
     154       *       is that of a file -- not this method.  Coverity Id 20.
     155       */
     156      else if (linkflag == REGTYPE) {
    150157         const char  *name;
    151158
    152159         loc = root_loc;
    153          if (IMFS_evaluate_for_make(filename, &loc, &name) == 0)
    154          {
     160         if (IMFS_evaluate_for_make(filename, &loc, &name) == 0) {
    155161            node = IMFS_create_node(&loc,
    156162                        IMFS_LINEAR_FILE, (char *)name,
     
    166172   }
    167173
    168    return(status);
     174   return status;
    169175}
    170176
  • cpukit/libfs/src/imfs/imfs_mknod.c

    r2bac9489 r9ba0e55  
    44 *  Routine to create a node in the IMFS file system.
    55 *
    6  *  COPYRIGHT (c) 1989-1999.
     6 *  COPYRIGHT (c) 1989-2010.
    77 *  On-Line Applications Research Corporation (OAR).
    88 *
     
    6464  /*
    6565   *  Allocate and fill in an IMFS jnode
     66   *
     67   * NOTE: Coverity thinks this is a resource leak since a node
     68   *       is created but never deleted.  The scope of the allocation
     69   *       is that of a file -- not this method.  Coverity Id 21.
    6670   */
    67 
    6871  new_node = IMFS_create_node(
    6972    pathloc,
Note: See TracChangeset for help on using the changeset viewer.