[U-Boot-Users] FIX: dataflash.c

Ulf Samuelsson ulf at atmel.com
Sun Aug 19 15:04:12 CEST 2007


>  for (i = 0; i < CFG_MAX_DATAFLASH_BANKS; i++)
>  if ( dataflash_info[i].id
> - && ((((int) addr) & 0xFF000000) ==
> + && ((((unsigned int) *addr) & 0xFF000000) ==
>  dataflash_info[i].logical_address)) {
>  addr_valid = 1;
>  break;
>
> It fix an invalid use of a pointer and and invalid use of an array.
> 
> regards michael
> 
>

AFAIK, This patch is introducing a bug.

The intention of the code is to check if  "addr" is within
0xC0000000..0xCFFFFFFF    or
0xD0000000..0xDFFFFFFF.

Your patch will make the ARM core *read* from whereever 'addr' is pointing at.

'addr' is an address specified by the user!

You do not know *where* is it located, and if the ARM reads
from an arbitrary address, there is a big chance that it will trap...

Best Regards
Ulf Samuelsson





More information about the U-Boot mailing list