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

From: Pankaj Gupta

Date: Thu May 14 2026 - 05:04:50 EST


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@xxxxxxxxx>
Closes: https://lore.kernel.org/oe-kbuild-all/202605081441.lIHK75ug-lkp@xxxxxxxxx/
Fixes: 890e531b38f89 ("firmware: drivers: imx: adds miscdev")
Signed-off-by: Pankaj Gupta <pankaj.gupta@xxxxxxx>
---
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