Changeset 45578


Ignore:
Timestamp:
2015-04-24T16:28:57+02:00 (3 years ago)
Author:
rmilecki
Message:

nvram: fix regression in finding NVRAM beginning

The loop was giving up too early as it never expected NVRAM smaller
than 0x10000.

Signed-off-by: Rafał Miłecki <zajec5@…>

Location:
trunk/package/utils/nvram/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/utils/nvram/src/nvram.c

    r45565 r45578  
    365365                if( mmap_area != MAP_FAILED ) 
    366366                { 
    367                         for( i = 0; i <= ((nvram_part_size - NVRAM_SPACE) / sizeof(uint32_t)); i++ ) 
     367                        /* 
     368                         * Start looking for NVRAM_MAGIC at beginning of MTD 
     369                         * partition. Stop if there is less than NVRAM_MIN_SPACE 
     370                         * to check, that was the lowest used size. 
     371                         */ 
     372                        for( i = 0; i <= ((nvram_part_size - NVRAM_MIN_SPACE) / sizeof(uint32_t)); i++ ) 
    368373                        { 
    369374                                if( ((uint32_t *)mmap_area)[i] == NVRAM_MAGIC ) 
  • trunk/package/utils/nvram/src/nvram.h

    r45566 r45578  
    114114 
    115115/* NVRAM constants */ 
     116#define NVRAM_MIN_SPACE                 0x8000 
    116117#define NVRAM_SPACE                     0x10000 
    117118#define NVRAM_MAGIC                     0x48534C46      /* 'FLSH' */ 
Note: See TracChangeset for help on using the changeset viewer.