mailbox: zynqmp: Fix off by 1 errors

Use resource_size to correctly calculate the size to pass to
devm_ioremap and avoid the off by 1 errors previously present.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Link: https://lore.kernel.org/r/20250728-zynqmp-ipi-v1-1-b2bd144a9521@linaro.org
Signed-off-by: Michal Simek <michal.simek@amd.com>
This commit is contained in:
Andrew Goodbody
2025-07-28 16:47:09 +01:00
committed by Michal Simek
parent 7d879baa6f
commit 0d1c4fd514

View File

@@ -188,7 +188,7 @@ static int zynqmp_ipi_dest_probe(struct udevice *dev)
return -EINVAL;
};
zynqmp->local_req_regs = devm_ioremap(dev, res.start,
(res.start - res.end));
resource_size(&res));
if (!zynqmp->local_req_regs)
return -EINVAL;
@@ -197,7 +197,7 @@ static int zynqmp_ipi_dest_probe(struct udevice *dev)
return -EINVAL;
};
zynqmp->local_res_regs = devm_ioremap(dev, res.start,
(res.start - res.end));
resource_size(&res));
if (!zynqmp->local_res_regs)
return -EINVAL;
@@ -206,7 +206,7 @@ static int zynqmp_ipi_dest_probe(struct udevice *dev)
return -EINVAL;
};
zynqmp->remote_req_regs = devm_ioremap(dev, res.start,
(res.start - res.end));
resource_size(&res));
if (!zynqmp->remote_req_regs)
return -EINVAL;
@@ -215,7 +215,7 @@ static int zynqmp_ipi_dest_probe(struct udevice *dev)
return -EINVAL;
};
zynqmp->remote_res_regs = devm_ioremap(dev, res.start,
(res.start - res.end));
resource_size(&res));
if (!zynqmp->remote_res_regs)
return -EINVAL;