diff options
author | Rahul Kumar Yadav <rahulkumar.yadav@nxp.com> | 2023-06-14 17:09:50 +0530 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2023-09-12 17:17:59 -0500 |
commit | 50912be386017c8d2ca7f0c9c0a32fa7ac84a283 (patch) | |
tree | 37f3c2146a64ec8a0f9d3b8eab006cca2d935e47 | |
parent | 2c1973840fd8f7541c56853e104fe3504b402a84 (diff) |
LF-7374: firmware: imx: fix coverity issue in seco-mu
Fix the coverity issue: 24243097: Untrusted value as argument,
found in the SECO MU driver.
Added max length condition for io.length, in case of
flag SECO_MU_IO_FLAGS_SHE_V2X enabled
Signed-off-by: Rahul Kumar Yadav <rahulkumar.yadav@nxp.com>
(cherry picked from commit 018531830f1fb1354e1956521b5c873a755a1372)
-rw-r--r-- | drivers/firmware/imx/seco_mu.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/firmware/imx/seco_mu.c b/drivers/firmware/imx/seco_mu.c index 75c721100915..ee84889029be 100644 --- a/drivers/firmware/imx/seco_mu.c +++ b/drivers/firmware/imx/seco_mu.c @@ -680,6 +680,12 @@ static int seco_mu_ioctl_setup_iobuf_handler(struct seco_mu_device_ctx *dev_ctx, shared_mem->pos += round_up(io.length, 8u); io.seco_addr = (u64)shared_mem->dma_addr + pos; } else { + if (io.length > MAX_DATA_SIZE_PER_USER) { + devctx_err(dev_ctx, "Buffer length exceeded the max limit\n"); + err = -ENOMEM; + goto exit; + } + io.seco_addr = (u64)addr; } |