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

Michael Trimarchi trimarchi at gandalf.sssup.it
Sun Aug 19 21:29:51 CEST 2007


Ulf Samuelsson wrote:
>>  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
>
>
>   
* addr is the value of the logical address to check. addr is the address 
of the variable that contain the logical address.
I think that my patch is ok but reversed .orig .new.
Regards Michael





More information about the U-Boot mailing list