Changeset db99ce7c in rtems


Ignore:
Timestamp:
Aug 23, 2013, 7:02:40 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.10
Children:
2077ae4c
Parents:
356b8c7b
git-author:
Sebastian Huber <sebastian.huber@…> (08/23/13 07:02:40)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/23/13 07:34:13)
Message:

libblock: PR2040: Avoid NULL pointer access

This partly reverts commit 08b9d534604fbf437743a9925ef28eb1b848510d.

Avoid a NULL pointer access and perform the source segment erase if
necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libblock/src/flashdisk.c

    r356b8c7b rdb99ce7c  
    12641264    rtems_fdisk_page_desc* spd = &ssc->page_descriptors[spage];
    12651265
    1266     if (!dsc && ssc->pages_active > 0)
    1267     {
    1268       rtems_fdisk_error ("recycle: no available dst segment");
    1269       return EIO;
    1270     }
    1271 
    12721266    if (rtems_fdisk_page_desc_flags_set (spd, RTEMS_FDISK_PAGE_ACTIVE) &&
    12731267        !rtems_fdisk_page_desc_flags_set (spd, RTEMS_FDISK_PAGE_USED))
     
    13591353      dst_pages = rtems_fdisk_seg_pages_available (dsc);
    13601354      if (dst_pages == 0)
     1355      {
    13611356        dsc = rtems_fdisk_seg_most_available (&fd->available);
     1357        if (!dsc)
     1358        {
     1359          if (ssc->pages_active == 0)
     1360          {
     1361            ret = rtems_fdisk_erase_segment (fd, ssc);
     1362          }
     1363          else
     1364          {
     1365            rtems_fdisk_error ("recycle: no available dst segment");
     1366            ret = EIO;
     1367          }
     1368
     1369          return ret;
     1370        }
     1371      }
    13621372
    13631373      (*pages)--;
Note: See TracChangeset for help on using the changeset viewer.