nvmem: fixes for v7.0
Subsystems (5)
[email protected]
maintainercover nvmem: fixes for v7.0
From: Srinivas Kandagatla <[email protected]>
Hi Greg,
Here are two nvmem fixes which can go for 7.0 release If its not too late, could you please queue these as 7.0 material.
Thanks for all the help,
Srini
Christian Eggers (1):
nvmem: imx: assign nvmem_cell_info::raw_len
Ivan Vera (1):
nvmem: zynqmp_nvmem: Fix buffer size in DMA and memcpy
drivers/nvmem/imx-ocotp-ele.c | 1 + drivers/nvmem/imx-ocotp.c | 1 + drivers/nvmem/zynqmp_nvmem.c | 8 ++++---- 3 files changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
2.47.3
[email protected]
maintainerPATCH 1/2 nvmem: imx: assign nvmem_cell_info::raw_len
From: Christian Eggers <[email protected]>
Avoid getting error messages at startup like the following on i.MX6ULL:
nvmem imx-ocotp0: cell mac-addr raw len 6 unaligned to nvmem word size 4 nvmem imx-ocotp0: cell mac-addr raw len 6 unaligned to nvmem word size 4
This shouldn't cause any functional change as this alignment would otherwise be done in nvmem_cell_info_to_nvmem_cell_entry_nodup().
--- drivers/nvmem/imx-ocotp-ele.c | 1 + drivers/nvmem/imx-ocotp.c | 1 + 2 files changed, 2 insertions(+)
drivers/nvmem/imx-ocotp-ele.c +1 -0
@@ -131,6 +131,7 @@ static int imx_ocotp_cell_pp(void *context, const char *id, int index,static void imx_ocotp_fixup_dt_cell_info (struct nvmem_device *nvmem,struct nvmem_cell_info *cell) { + cell->raw_len =round_up (cell->bytes,4 ); cell->read_post_process = imx_ocotp_cell_pp; }
drivers/nvmem/imx-ocotp.c +1 -0
@@ -589,6 +589,7 @@ MODULE_DEVICE_TABLE(of, imx_ocotp_dt_ids);static void imx_ocotp_fixup_dt_cell_info (struct nvmem_device *nvmem,struct nvmem_cell_info *cell) { + cell->raw_len =round_up (cell->bytes,4 ); cell->read_post_process = imx_ocotp_cell_pp; }
Signature · 1 line
2.47.3
[email protected]
maintainerPATCH 2/2 nvmem: zynqmp_nvmem: Fix buffer size in DMA and memcpy
In reply to [email protected]From: Ivan Vera <[email protected]>
Buffer size used in dma allocation and memcpy is wrong. It can lead to undersized DMA buffer access and possible memory corruption. use correct buffer size in dma_alloc_coherent and memcpy.
--- drivers/nvmem/zynqmp_nvmem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/nvmem/zynqmp_nvmem.c +4 -4
@@ -66,7 +66,7 @@ static int zynqmp_efuse_access(void *context, unsigned int offset,dma_addr_t dma_buf;size_t words = bytes /WORD_INBYTES ;int ret; -int value; +unsigned int value;char *data;if (bytes %WORD_INBYTES !=0 ) {
@@ -80,7 +80,7 @@ static int zynqmp_efuse_access(void *context, unsigned int offset, }if (pufflag ==1 && flag ==EFUSE_WRITE ) { -memcpy (&value, val, bytes); +memcpy (&value, val,sizeof (value));if ((offset ==EFUSE_PUF_START_OFFSET || offset ==EFUSE_PUF_MID_OFFSET ) && value &P_USER_0_64_UPPER_MASK ) {
@@ -100,7 +100,7 @@ static int zynqmp_efuse_access(void *context, unsigned int offset,if (!efuse)return -ENOMEM ; - data =dma_alloc_coherent (dev,sizeof (bytes), + data =dma_alloc_coherent (dev, bytes, &dma_buf,GFP_KERNEL );if (!data) { ret = -ENOMEM ;
@@ -134,7 +134,7 @@ static int zynqmp_efuse_access(void *context, unsigned int offset,if (flag ==EFUSE_READ )memcpy (val, data, bytes); efuse_access_err: -dma_free_coherent (dev,sizeof (bytes), +dma_free_coherent (dev, bytes, data, dma_buf); efuse_data_fail: dma_free_coherent(dev, sizeof(struct xilinx_efuse),
Signature · 1 line
2.47.3