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: