[Tinyos-devel] Bug in Stm25pLogP.nc

Philip Levis pal at cs.stanford.edu
Thu Jun 7 12:58:25 PDT 2007


On Jun 6, 2007, at 2:32 PM, Chieh-Jan (Mike) Liang wrote:

> Sorry, when I said "return FALSE", I actually meant "return TRUE".
>
> Mike
>
> Chieh-Jan (Mike) Liang wrote:
>> Please correct me if I am wrong, but there is a bug in  
>> Sector.readDone[uint8_t id](...) in tos/chips/stm25p/ 
>> Stm25pLogP.nc. The lines in question are:
>> 320 uint8_t block = addr >> BLOCK_SIZE_LOG2;
>> ...
>> 329 if (++block < (call Sector.getNumSectors[ id ]() 
>> *BLOCKS_PER_SECTOR))
>> block is 8-bit, or 0 - 255. In the extreme case, I can have my log  
>> volume occupy the whole STM25P flash (16 sectors), which would  
>> make the right-hand side of the condition 256. Therefore, line 329  
>> will always return FALSE.
>> My proposal is to change line 320 to "uint16_t block = (addr >>  
>> BLOCK_SIZE_LOG2) & 0xFF;"
>> Thank you
>> Mike
>> _______________________________________________
>> Tinyos-devel mailing list
>> Tinyos-devel at Millennium.Berkeley.EDU
>> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/ 
>> tinyos-devel
> _______________________________________________

Jonathan's taken a look and has fixed the bug. Nice catch!

Phil


More information about the Tinyos-devel mailing list