Hi,

This is the original definition:
        #if defined(CFG_ENV_IS_EMBEDDED)
        #define TOTAL_MALLOC_LEN        CFG_MALLOC_LEN
        #elif ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) < CFG_MONITOR_BASE) || 
                (CFG_ENV_ADDR >= (CFG_MONITOR_BASE + CFG_MONITOR_LEN)) )
|| \
              defined(CFG_ENV_IS_IN_NVRAM)
        #define TOTAL_MALLOC_LEN        (CFG_MALLOC_LEN + CFG_ENV_SIZE)
        #else
        #define TOTAL_MALLOC_LEN        CFG_MALLOC_LEN
        #endif

While if your CFG_ENV_ADDR+CFG_ENV_SIZE is just equal with
CFG_MONITOR_BASE and CFG_MALLOC_LEN is smaller than CFG_ENV_SIZE.
Invalid pointer will be set to env_ptr in env_relocate () functions.
Later operations to the environment will always to be performed to this
invalid pointer address. And this might cause some abnormals in system
level. In my testing board, the interrupts' enabling will trigger system
hang-up under such abnormal situations.

The correct definition to fix this problem is:
        #if defined(CFG_ENV_IS_EMBEDDED)
        #define TOTAL_MALLOC_LEN        CFG_MALLOC_LEN
        #elif ( ((CFG_ENV_ADDR+CFG_ENV_SIZE) <= CFG_MONITOR_BASE) || 
                (CFG_ENV_ADDR >= (CFG_MONITOR_BASE + CFG_MONITOR_LEN)) )
|| \
              defined(CFG_ENV_IS_IN_NVRAM)
        #define TOTAL_MALLOC_LEN        (CFG_MALLOC_LEN + CFG_ENV_SIZE)
        #else
        #define TOTAL_MALLOC_LEN        CFG_MALLOC_LEN
        #endif

Regards,
Tony


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

Reply via email to