[PATCH 7/7] firmware: imx: ele: Fix debug dump size handling
From: Peng Fan (OSS)
Date: Mon May 25 2026 - 01:40:48 EST
From: Peng Fan <peng.fan@xxxxxxx>
The ELE debug dump response is formatted as:
- header (1 u32)
- status (1 u32)
- dump words (2..21 u32)
- CRC (1 u32)
The header.size field represents the total number of u32 words,
not a byte count.
After removing the header and status (2 words), header.size still
includes the trailing CRC. Therefore, when determining the number
of valid debug words, the CRC must be excluded as well.
The existing check:
if (rx_msg->header.size > 4)
is incorrect because header.size has already been reduced by 2.
Fix it by comparing against the remaining minimum (CRC + debug words),
i.e.:
if (rx_msg->header.size > 2)
and then decrement to account for the CRC.
Fixes: 106ffe5d78ad8 ("firmware: imx: add driver for NXP EdgeLock Enclave")
Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
---
drivers/firmware/imx/ele_base_msg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/imx/ele_base_msg.c b/drivers/firmware/imx/ele_base_msg.c
index 2f0046cd5ad06d28c11ad5bf7b8544d1aa9b9bb6..ec718d322abcd7e120d916bbcbcf691f3078c628 100644
--- a/drivers/firmware/imx/ele_base_msg.c
+++ b/drivers/firmware/imx/ele_base_msg.c
@@ -290,7 +290,7 @@ int ele_debug_dump(struct se_if_priv *priv)
rx_msg->header.size -= 2;
- if (rx_msg->header.size > 4)
+ if (rx_msg->header.size > 2)
rx_msg->header.size--;
for (i = 0; i < rx_msg->header.size; i += 2)
--
2.37.1