Skip to content

Commit

Permalink
remoteproc: imx_rproc: fix a couple off by one bugs
Browse files Browse the repository at this point in the history
The priv->mem[] array has IMX7D_RPROC_MEM_MAX elements so the > should
be >= to avoid writing one element beyond the end of the array.

Fixes: a0ff4aa ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
  • Loading branch information
Dan Carpenter authored and Bjorn Andersson committed Oct 10, 2017
1 parent 2bd6bf0 commit 68c2d64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/remoteproc/imx_rproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
if (!(att->flags & ATT_OWN))
continue;

if (b > IMX7D_RPROC_MEM_MAX)
if (b >= IMX7D_RPROC_MEM_MAX)
break;

priv->mem[b].cpu_addr = devm_ioremap(&pdev->dev,
Expand Down Expand Up @@ -296,7 +296,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
return err;
}

if (b > IMX7D_RPROC_MEM_MAX)
if (b >= IMX7D_RPROC_MEM_MAX)
break;

priv->mem[b].cpu_addr = devm_ioremap_resource(&pdev->dev, &res);
Expand Down

0 comments on commit 68c2d64

Please sign in to comment.