summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/fal/src/fal_flash.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/components/fal/src/fal_flash.c b/components/fal/src/fal_flash.c
index b0ca60f0c9..351a31f473 100644
--- a/components/fal/src/fal_flash.c
+++ b/components/fal/src/fal_flash.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2024 RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -54,6 +54,14 @@ int fal_flash_init(void)
size_t blk_len = blk->count * blk->size;
if (blk->count == 0 || blk->size == 0)
break;
+
+ if(offset > device_table[i]->len)
+ {
+ log_i("Flash device %*.*s: add block failed, offset %d > len %d.",
+ FAL_DEV_NAME_MAX, FAL_DEV_NAME_MAX, device_table[i]->name, device_table[i]->addr, offset, device_table[i]->len);
+ break;
+ }
+
log_d(" blk%2d | addr: 0x%08lx | len: 0x%08x | blk_size: 0x%08x |initialized finish.",
j, device_table[i]->addr + offset, blk_len, blk->size);
offset += blk_len;