Changeset fa4fe456 in rtems


Ignore:
Timestamp:
Jan 30, 2014, 1:58:41 AM (5 years ago)
Author:
Nick Withers <nick.withers@…>
Branches:
4.11, master
Children:
f54e503
Parents:
2501814
git-author:
Nick Withers <nick.withers@…> (01/30/14 01:58:41)
git-committer:
Sebastian Huber <sebastian.huber@…> (12/03/14 06:51:02)
Message:

Move the flash size probe into bankValidate()

Previously, bankValidate() could be called (e.g., BSP_flashWrite() -> regionCheckAndErase() -> argcheck() -> bankValidate()) without the probe having happened. When it then invoked BSP_flashCheckId(), unmapped memory could be read, possibly causing a fatal exception.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/powerpc/shared/flash/flash.c

    r2501814 rfa4fe456  
    457457        }
    458458
     459        if ( !b->size && !(b->size = BSP_flashProbeSize(b)) ) {
     460                fprintf(stderr,"Configuration Error - unable to determine flash size\n");
     461                return 0;
     462        }
     463
    459464        if ( !b->dd && !(b->dd = BSP_flashCheckId(b, b->start,1)) ) {
    460465                fprintf(stderr,"Error: unable to detect flash device in bank #%i\n", bank);
     
    486491        }
    487492
    488         if ( !b->size && !(b->size = BSP_flashProbeSize(b)) ) {
    489                 fprintf(stderr,"Configuration Error - unable to determine flash size\n");
    490                 return 0;
    491         }
    492493        if ( offset + size > b->size ) {
    493494                fprintf(stderr,"Error: requested size exceeds available flash (0x%08"PRIx32" bytes)\n", b->size);
Note: See TracChangeset for help on using the changeset viewer.