[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250815111619.45001-10-mikhail.kshevetskiy@iopsys.eu>
Date: Fri, 15 Aug 2025 14:16:15 +0300
From: Mikhail Kshevetskiy <mikhail.kshevetskiy@...sys.eu>
To: Lorenzo Bianconi <lorenzo@...nel.org>,
Ray Liu <ray.liu@...oha.com>,
Mark Brown <broonie@...nel.org>,
linux-arm-kernel@...ts.infradead.org,
linux-spi@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Mikhail Kshevetskiy <mikhail.kshevetskiy@...sys.eu>
Subject: [PATCH v2 09/13] spi: airoha: buffer must be 0xff-ed before writing
During writing, the entire flash page (including OOB) will be updated
with the values from the temporary buffer, so we need to fill the
untouched areas of the buffer with 0xff value to prevent accidental
data overwriting.
Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@...sys.eu>
---
drivers/spi/spi-airoha-snfi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/spi/spi-airoha-snfi.c b/drivers/spi/spi-airoha-snfi.c
index 6b1422ab4240..ed49bca1f9ac 100644
--- a/drivers/spi/spi-airoha-snfi.c
+++ b/drivers/spi/spi-airoha-snfi.c
@@ -844,6 +844,9 @@ static ssize_t airoha_snand_dirmap_write(struct spi_mem_dirmap_desc *desc,
return -EOPNOTSUPP;
}
+ memset(txrx_buf, 0xff,
+ (as_ctrl->nfi_cfg.sec_size + as_ctrl->nfi_cfg.spare_size) *
+ as_ctrl->nfi_cfg.sec_num);
memcpy(txrx_buf + offs, buf, len);
err = airoha_snand_set_mode(as_ctrl, SPI_MODE_DMA);
--
2.50.1
Powered by blists - more mailing lists