summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAndrew Goodbody <[email protected]>2025-07-28 16:47:09 +0100
committerMichal Simek <[email protected]>2025-08-25 16:20:47 +0200
commit0d1c4fd514c13fbda3b3016cfa9ce00b01e42bf9 (patch)
tree5a5a7ba07b9677b6381bba72a4c490aee5ecdc49 /drivers
parent7d879baa6f7ca201bcecff74f2a7545560289280 (diff)
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michal Simek <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mailbox/zynqmp-ipi.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/mailbox/zynqmp-ipi.c b/drivers/mailbox/zynqmp-ipi.c
index 851aa737c03..f62277385fb 100644
--- a/drivers/mailbox/zynqmp-ipi.c
+++ b/drivers/mailbox/zynqmp-ipi.c
@@ -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;