Skip to content

Commit 83b9e5e

Browse files
vai-tommealexandrebelloni
authored andcommitted
rtc: zynqmp: check calibration max value
Enable check to not overflow the calibration max value. Reviewed-by: Harini T <harini.t@amd.com> Tested-by: Harini T <harini.t@amd.com> Signed-off-by: Tomas Melin <tomas.melin@vaisala.com> Acked-by: Michal Simek <michal.simek@amd.com> Link: https://patch.msgid.link/20260122-zynqmp-rtc-updates-v4-2-d4edb966b499@vaisala.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 2724fb4 commit 83b9e5e

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/rtc/rtc-zynqmp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,11 @@ static int xlnx_rtc_probe(struct platform_device *pdev)
349349
xrtcdev->freq--;
350350
}
351351

352+
if (xrtcdev->freq > RTC_TICK_MASK) {
353+
dev_err(&pdev->dev, "Invalid RTC calibration value\n");
354+
return -EINVAL;
355+
}
356+
352357
ret = readl(xrtcdev->reg_base + RTC_CALIB_RD);
353358
if (!ret)
354359
writel(xrtcdev->freq, (xrtcdev->reg_base + RTC_CALIB_WR));

0 commit comments

Comments
 (0)