Skip to content

Commit

Permalink
LF-7374: firmware: imx: fix coverity issue in seco-mu
Browse files Browse the repository at this point in the history
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 0185318)
  • Loading branch information
RahulKumarYadav1 authored and ray-chang committed Nov 21, 2023
1 parent 30bdae2 commit 6bcae12
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/firmware/imx/seco_mu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 6bcae12

Please sign in to comment.