Skip to content

Commit 0f7dd52

Browse files
committed
fix: Wrong out of range check in lx_nand_flash_block_find
Fix issue 53 Signed-off-by: Haithem Rahmani <haithem.rahmani@st.com>
1 parent 04e385f commit 0f7dd52

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

common/src/lx_nand_flash_block_find.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ UINT _lx_nand_flash_block_find(LX_NAND_FLASH *nand_flash, ULONG logical_sector,
9090
block_mapping_index = logical_sector / nand_flash -> lx_nand_flash_pages_per_block;
9191

9292
/* Check the address range. */
93-
if (block_mapping_index > nand_flash -> lx_nand_flash_block_mapping_table_size / sizeof(*nand_flash -> lx_nand_flash_block_mapping_table))
93+
if (block_mapping_index >= nand_flash -> lx_nand_flash_block_mapping_table_size / sizeof(*nand_flash -> lx_nand_flash_block_mapping_table))
9494
{
9595

9696
/* Out of range, return an error. */

0 commit comments

Comments
 (0)