summaryrefslogtreecommitdiff
path: root/env
diff options
context:
space:
mode:
authorShiji Yang <[email protected]>2025-07-25 08:20:45 +0800
committerTom Rini <[email protected]>2025-08-01 17:58:59 -0600
commit7e842bd33154946052068195df3446635236d3d9 (patch)
tree2a050857eb55c80a4f9c29db2209c895c576cd67 /env
parent39ae954b04ef2fc4a8c14410379b663deb391fde (diff)
env: mtd: initialize saved_buf pointer
When sect_size is greater than the CONFIG_ENV_SIZE, this wild pointer will cause CPU halt or system crash. Fixes: 03fb08d4aef8 ("env: Introduce support for MTD") Signed-off-by: Shiji Yang <[email protected]>
Diffstat (limited to 'env')
-rw-r--r--env/mtd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/env/mtd.c b/env/mtd.c
index ad263ed4b29..b26ee80985a 100644
--- a/env/mtd.c
+++ b/env/mtd.c
@@ -201,7 +201,7 @@ static int env_mtd_erase(void)
{
struct mtd_info *mtd_env;
u32 sect_size, sect_num;
- char *saved_buf, *tmp;
+ char *saved_buf = NULL, *tmp;
struct erase_info ei;
size_t ret_len;
int remaining;