Off-by-one in tutorial FTL

From OpenSSDWiki
Viewed 4126 times, With a total of 1 Posts
Jump to: navigation, search

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]) {

Just Got Here
Threads 3
Posts 4
Looks like this bug still persists after 4 years! Thanks for bringing this to everyone's notice!
Edited On 1:06:11 AM - Thu, Mar 3rd 2016 by Abhishekjoshi


Forum >> Jasmine OpenSSD Platform >> Jasmine Firmware



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