Changeset dbdfc78 in rtems


Ignore:
Timestamp:
Aug 23, 2013, 7:02:40 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
630365b
Parents:
38ec8af
git-author:
Sebastian Huber <sebastian.huber@…> (08/23/13 07:02:40)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/23/13 07:24:10)
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

    r38ec8af rdbdfc78  
    12671267    rtems_fdisk_page_desc* spd = &ssc->page_descriptors[spage];
    12681268
    1269     if (!dsc && ssc->pages_active > 0)
    1270     {
    1271       rtems_fdisk_error ("recycle: no available dst segment");
    1272       return EIO;
    1273     }
    1274 
    12751269    if (rtems_fdisk_page_desc_flags_set (spd, RTEMS_FDISK_PAGE_ACTIVE) &&
    12761270        !rtems_fdisk_page_desc_flags_set (spd, RTEMS_FDISK_PAGE_USED))
     
    13621356      dst_pages = rtems_fdisk_seg_pages_available (dsc);
    13631357      if (dst_pages == 0)
     1358      {
    13641359        dsc = rtems_fdisk_seg_most_available (&fd->available);
     1360        if (!dsc)
     1361        {
     1362          if (ssc->pages_active == 0)
     1363          {
     1364            ret = rtems_fdisk_erase_segment (fd, ssc);
     1365          }
     1366          else
     1367          {
     1368            rtems_fdisk_error ("recycle: no available dst segment");
     1369            ret = EIO;
     1370          }
     1371
     1372          return ret;
     1373        }
     1374      }
    13651375
    13661376      (*pages)--;
Note: See TracChangeset for help on using the changeset viewer.