* [PATCH 1/2] nvmem: imx: assign nvmem_cell_info::raw_len
2025-07-11 11:55 [PATCH 0/2] nvmem: Fix reading MAC address from OCOTP on i.MX Christian Eggers
@ 2025-07-11 11:55 ` Christian Eggers
0 siblings, 0 replies; 4+ messages in thread
From: Christian Eggers @ 2025-07-11 11:55 UTC (permalink / raw)
To: Srinivas Kandagatla, Shawn Guo, Sascha Hauer, Dmitry Baryshkov,
Rafał Miłecki
Cc: Pengutronix Kernel Team, Fabio Estevam, Greg Kroah-Hartman,
Sasha Levin, imx, linux-arm-kernel, linux-kernel,
Christian Eggers, stable
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().
Fixes: 4327479e559c ("nvmem: core: verify cell's raw_len")
Signed-off-by: Christian Eggers <ceggers@arri.de>
Cc: stable@vger.kernel.org
---
Tested on i.MX6ULL, but I assume that this is also required for
imx-ocotp-ele.c (i.MX93).
drivers/nvmem/imx-ocotp-ele.c | 1 +
drivers/nvmem/imx-ocotp.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/nvmem/imx-ocotp-ele.c b/drivers/nvmem/imx-ocotp-ele.c
index ca6dd71d8a2e..83617665c8d7 100644
--- a/drivers/nvmem/imx-ocotp-ele.c
+++ b/drivers/nvmem/imx-ocotp-ele.c
@@ -128,6 +128,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;
}
diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
index 79dd4fda0329..22cc77908018 100644
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -586,6 +586,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;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 0/2] nvmem: fixes for v7.0
@ 2026-03-27 13:16 srini
2026-03-27 13:16 ` [PATCH 1/2] nvmem: imx: assign nvmem_cell_info::raw_len srini
2026-03-27 13:16 ` [PATCH 2/2] nvmem: zynqmp_nvmem: Fix buffer size in DMA and memcpy srini
0 siblings, 2 replies; 4+ messages in thread
From: srini @ 2026-03-27 13:16 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, Srinivas Kandagatla
From: Srinivas Kandagatla <srini@kernel.org>
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(-)
--
2.47.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] nvmem: imx: assign nvmem_cell_info::raw_len
2026-03-27 13:16 [PATCH 0/2] nvmem: fixes for v7.0 srini
@ 2026-03-27 13:16 ` srini
2026-03-27 13:16 ` [PATCH 2/2] nvmem: zynqmp_nvmem: Fix buffer size in DMA and memcpy srini
1 sibling, 0 replies; 4+ messages in thread
From: srini @ 2026-03-27 13:16 UTC (permalink / raw)
To: gregkh
Cc: linux-kernel, Christian Eggers, stable, Fabio Estevam,
Srinivas Kandagatla
From: Christian Eggers <ceggers@arri.de>
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().
Cc: stable@vger.kernel.org
Fixes: 13bcd440f2ff ("nvmem: core: verify cell's raw_len")
Signed-off-by: Christian Eggers <ceggers@arri.de>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
drivers/nvmem/imx-ocotp-ele.c | 1 +
drivers/nvmem/imx-ocotp.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/nvmem/imx-ocotp-ele.c b/drivers/nvmem/imx-ocotp-ele.c
index 7cf7e809a8f5..a0d2985c6d03 100644
--- a/drivers/nvmem/imx-ocotp-ele.c
+++ b/drivers/nvmem/imx-ocotp-ele.c
@@ -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;
}
diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c
index 7bf7656d4f96..108d78d7f6cb 100644
--- a/drivers/nvmem/imx-ocotp.c
+++ b/drivers/nvmem/imx-ocotp.c
@@ -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;
}
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] nvmem: zynqmp_nvmem: Fix buffer size in DMA and memcpy
2026-03-27 13:16 [PATCH 0/2] nvmem: fixes for v7.0 srini
2026-03-27 13:16 ` [PATCH 1/2] nvmem: imx: assign nvmem_cell_info::raw_len srini
@ 2026-03-27 13:16 ` srini
1 sibling, 0 replies; 4+ messages in thread
From: srini @ 2026-03-27 13:16 UTC (permalink / raw)
To: gregkh
Cc: linux-kernel, Ivan Vera, stable, Harish Ediga, Harsh Jain,
Srinivas Kandagatla
From: Ivan Vera <ivanverasantos@gmail.com>
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.
Fixes: 737c0c8d07b5 ("nvmem: zynqmp_nvmem: Add support to access efuse")
Cc: stable@vger.kernel.org
Signed-off-by: Ivan Vera <ivanverasantos@gmail.com>
Signed-off-by: Harish Ediga <harish.ediga@amd.com>
Signed-off-by: Harsh Jain <h.jain@amd.com>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
drivers/nvmem/zynqmp_nvmem.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/nvmem/zynqmp_nvmem.c b/drivers/nvmem/zynqmp_nvmem.c
index 7da717d6c7fa..d297ff150dc0 100644
--- a/drivers/nvmem/zynqmp_nvmem.c
+++ b/drivers/nvmem/zynqmp_nvmem.c
@@ -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),
--
2.47.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-27 13:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27 13:16 [PATCH 0/2] nvmem: fixes for v7.0 srini
2026-03-27 13:16 ` [PATCH 1/2] nvmem: imx: assign nvmem_cell_info::raw_len srini
2026-03-27 13:16 ` [PATCH 2/2] nvmem: zynqmp_nvmem: Fix buffer size in DMA and memcpy srini
-- strict thread matches above, loose matches on Subject: below --
2025-07-11 11:55 [PATCH 0/2] nvmem: Fix reading MAC address from OCOTP on i.MX Christian Eggers
2025-07-11 11:55 ` [PATCH 1/2] nvmem: imx: assign nvmem_cell_info::raw_len Christian Eggers
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.