[PATCH 5/7] firmware: imx: ele: Correct check_hdr_exception_for_sz
Peng Fan (OSS)
peng.fan at oss.nxp.com
Sun May 24 22:39:28 PDT 2026
From: Peng Fan <peng.fan at nxp.com>
header.size is u8 type, "header.size >= 0" will always return true.
Actually the check condition should be ">= 2", because a valid response
includes at lease header(4bytes) and status(4bytes), total 2 ints.
And ELE_DEBUG_DUMP_RSP_SZ is counted using bytes, need to divide it by 4.
Fixes: 106ffe5d78ad8 ("firmware: imx: add driver for NXP EdgeLock Enclave")
Signed-off-by: Peng Fan <peng.fan at nxp.com>
---
drivers/firmware/imx/ele_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/imx/ele_common.c b/drivers/firmware/imx/ele_common.c
index 8daf32eded43c62daf56540b63e292bf0c6c9845..76bd3841acfcb1ff33d3bc5d900300493190b8a8 100644
--- a/drivers/firmware/imx/ele_common.c
+++ b/drivers/firmware/imx/ele_common.c
@@ -164,7 +164,7 @@ static bool check_hdr_exception_for_sz(struct se_if_priv *priv,
*/
if (header->command == ELE_DEBUG_DUMP_REQ &&
header->ver == priv->if_defs->base_api_ver &&
- header->size >= 0 && header->size <= ELE_DEBUG_DUMP_RSP_SZ)
+ header->size >= 2 && header->size <= (ELE_DEBUG_DUMP_RSP_SZ / 4))
return true;
return false;
--
2.37.1
More information about the linux-arm-kernel
mailing list