Off-by-one in tutorial FTL

From OpenSSDWiki
You are viewing a single post from the thread title above
Jump to: navigation, search

Click here for full thread
Just Got Here
Threads 3
Posts 4
In function is_bad_block:

  if (mem_search_equ_dram
      (scan_list + bank, sizeof(UINT16), g_scan_list_entries[bank],
       pblk_offset) < g_scan_list_entries[bank]) {


there is an off-by-one, since the first uint16 at the address (scan_list + bank) is num_entries part of the struct scan_list_t; actual list starts at the next uint16. Thus, unless the last two bad physical blocks in a bank belong to the same virtual block, is_bad_block will return false for a bad virtual block. The following fixes that:

  if (mem_search_equ_dram
      ((UINT16 *)(scan_list + bank)+1, sizeof(UINT16), g_scan_list_entries[bank],
       pblk_offset) < g_scan_list_entries[bank]) {


Who's here now Members 0 Guests 0 Bots/Crawler 0


AWC's: 2.5.12 MediaWiki - Stand Alone Forum Extension
Forum theme style by: AWC
Views
Personal tools