From c2d9f865063fa33fb47a805e030d0a8b435d7156 Mon Sep 17 00:00:00 2001 From: qwang Date: Thu, 26 Oct 2023 14:29:33 +0800 Subject: [PATCH] [fix][flash] fix 2 buffer overflows Signed-off-by: qwang --- drivers/lhal/src/flash/bflb_sflash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/lhal/src/flash/bflb_sflash.c b/drivers/lhal/src/flash/bflb_sflash.c index 30f3af7c8..973c44dc7 100644 --- a/drivers/lhal/src/flash/bflb_sflash.c +++ b/drivers/lhal/src/flash/bflb_sflash.c @@ -1133,7 +1133,7 @@ void ATTR_TCM_SECTION bflb_sflash_set_burst_wrap(spi_flash_cfg_type *flash_cfg) dummy_clks = flash_cfg->burst_wrap_cmd_dmy_clk; cmd = flash_cfg->burst_wrap_cmd; wrap_data = flash_cfg->burst_wrap_data; - arch_memcpy4((uint32_t *)flash_ctrl_buf, &wrap_data, 4); + arch_memcpy4((uint32_t *)flash_ctrl_buf, &wrap_data, 1); flash_cmd.cmd_buf[0] = (cmd << 24); flash_cmd.rw_flag = SF_CTRL_WRITE; flash_cmd.dummy_clks = dummy_clks; @@ -1169,7 +1169,7 @@ void ATTR_TCM_SECTION bflb_sflash_disable_burst_wrap(spi_flash_cfg_type *flash_c dummy_clks = flash_cfg->de_burst_wrap_cmd_dmy_clk; cmd = flash_cfg->de_burst_wrap_cmd; wrap_data = flash_cfg->de_burst_wrap_data; - arch_memcpy4((uint32_t *)flash_ctrl_buf, &wrap_data, 4); + arch_memcpy4((uint32_t *)flash_ctrl_buf, &wrap_data, 1); flash_cmd.cmd_buf[0] = (cmd << 24); flash_cmd.rw_flag = SF_CTRL_WRITE; flash_cmd.dummy_clks = dummy_clks;