[PATCH -next] firmware: imx: secure-enclave: drop invalid overflow check in iobuf setup

Pankaj Gupta posted 1 patch 4 weeks, 1 day ago
drivers/firmware/imx/se_ctrl.c | 5 -----
1 file changed, 5 deletions(-)
[PATCH -next] firmware: imx: secure-enclave: drop invalid overflow check in iobuf setup
Posted by Pankaj Gupta 4 weeks, 1 day ago
io.length is a 32-bit value, so comparing it against SIZE_MAX is
tautological and always false on 64-bit systems. Clang flags this as
a constant out-of-range comparison.

Remove the invalid check and rely on size_t-based alignment and the
existing shared memory bounds validation.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202605081441.lIHK75ug-lkp@intel.com/
Fixes: 890e531b38f89 ("firmware: drivers: imx: adds miscdev")
Signed-off-by: Pankaj Gupta <pankaj.gupta@nxp.com>
---
 drivers/firmware/imx/se_ctrl.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/firmware/imx/se_ctrl.c b/drivers/firmware/imx/se_ctrl.c
index f88e581fc147..1683b259864f 100644
--- a/drivers/firmware/imx/se_ctrl.c
+++ b/drivers/firmware/imx/se_ctrl.c
@@ -670,11 +670,6 @@ static int se_ioctl_setup_iobuf_handler(struct se_if_device_ctx *dev_ctx,
 		goto copy;
 	}
 
-	if (io.length > SIZE_MAX - 7) {
-		dev_err(dev_ctx->priv->dev, "%s: Invalid buffer length.",
-			dev_ctx->devname);
-		return -EINVAL;
-	}
 	aligned_len = round_up((size_t)io.length, 8);
 
 	/* No specific requirement for this buffer. */
-- 
2.43.0
Re: [PATCH -next] firmware: imx: secure-enclave: drop invalid overflow check in iobuf setup
Posted by Frank.Li@oss.nxp.com 1 week, 3 days ago
From: Frank Li <Frank.Li@nxp.com>


On Thu, 14 May 2026 14:33:21 +0530, Pankaj Gupta wrote:
> io.length is a 32-bit value, so comparing it against SIZE_MAX is
> tautological and always false on 64-bit systems. Clang flags this as
> a constant out-of-range comparison.
>
> Remove the invalid check and rely on size_t-based alignment and the
> existing shared memory bounds validation.
>
> [...]

Applied, thanks!

[1/1] firmware: imx: secure-enclave: drop invalid overflow check in iobuf setup
      commit: af214594ea8ec75a71d32f982328df6bbc64704c

squash to previous's patch

Best regards,
--
Frank Li <Frank.Li@nxp.com>