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@gmail.com> SVN-Revision: 45578
This commit is contained in:
parent
84a3e668fc
commit
97a0e165a6
2 changed files with 7 additions and 1 deletions
|
@ -364,7 +364,12 @@ nvram_handle_t * nvram_open(const char *file, int rdonly)
|
||||||
|
|
||||||
if( mmap_area != MAP_FAILED )
|
if( mmap_area != MAP_FAILED )
|
||||||
{
|
{
|
||||||
for( i = 0; i <= ((nvram_part_size - NVRAM_SPACE) / sizeof(uint32_t)); i++ )
|
/*
|
||||||
|
* Start looking for NVRAM_MAGIC at beginning of MTD
|
||||||
|
* partition. Stop if there is less than NVRAM_MIN_SPACE
|
||||||
|
* to check, that was the lowest used size.
|
||||||
|
*/
|
||||||
|
for( i = 0; i <= ((nvram_part_size - NVRAM_MIN_SPACE) / sizeof(uint32_t)); i++ )
|
||||||
{
|
{
|
||||||
if( ((uint32_t *)mmap_area)[i] == NVRAM_MAGIC )
|
if( ((uint32_t *)mmap_area)[i] == NVRAM_MAGIC )
|
||||||
{
|
{
|
||||||
|
|
|
@ -113,6 +113,7 @@ char * nvram_find_staging(void);
|
||||||
#define NVRAM_ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))
|
#define NVRAM_ROUNDUP(x, y) ((((x)+((y)-1))/(y))*(y))
|
||||||
|
|
||||||
/* NVRAM constants */
|
/* NVRAM constants */
|
||||||
|
#define NVRAM_MIN_SPACE 0x8000
|
||||||
#define NVRAM_SPACE 0x10000
|
#define NVRAM_SPACE 0x10000
|
||||||
#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
|
#define NVRAM_MAGIC 0x48534C46 /* 'FLSH' */
|
||||||
#define NVRAM_VERSION 1
|
#define NVRAM_VERSION 1
|
||||||
|
|
Loading…
Reference in a new issue