提交 68c2d645 编写于 作者: D Dan Carpenter 提交者: Bjorn Andersson

remoteproc: imx_rproc: fix a couple off by one bugs

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: a0ff4aa6 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver")
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NBjorn Andersson <bjorn.andersson@linaro.org>
上级 2bd6bf03
...@@ -264,7 +264,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, ...@@ -264,7 +264,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
if (!(att->flags & ATT_OWN)) if (!(att->flags & ATT_OWN))
continue; continue;
if (b > IMX7D_RPROC_MEM_MAX) if (b >= IMX7D_RPROC_MEM_MAX)
break; break;
priv->mem[b].cpu_addr = devm_ioremap(&pdev->dev, priv->mem[b].cpu_addr = devm_ioremap(&pdev->dev,
...@@ -296,7 +296,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, ...@@ -296,7 +296,7 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
return err; return err;
} }
if (b > IMX7D_RPROC_MEM_MAX) if (b >= IMX7D_RPROC_MEM_MAX)
break; break;
priv->mem[b].cpu_addr = devm_ioremap_resource(&pdev->dev, &res); priv->mem[b].cpu_addr = devm_ioremap_resource(&pdev->dev, &res);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册