RE: [PATCH v2 2/5] rtc: zynqmp: check calibration max value
From: T, Harini <hidden>
Date: 2026-01-14 15:35:41
Also in:
linux-rtc, lkml
[Public] Reviewed-by: Harini T <redacted> Thanks, Harini T
quoted hunk ↗ jump to hunk
-----Original Message----- From: Tomas Melin <redacted> Sent: Thursday, January 8, 2026 6:21 PM To: Alexandre Belloni <alexandre.belloni@bootlin.com>; Simek, Michal [off-list ref] Cc: linux-rtc@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux- kernel@vger.kernel.org; Tomas Melin [off-list ref] Subject: [PATCH v2 2/5] rtc: zynqmp: check calibration max value Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding. Enable check to not overflow the calibration max value. Signed-off-by: Tomas Melin <redacted> --- drivers/rtc/rtc-zynqmp.c | 5 +++++ 1 file changed, 5 insertions(+)diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index856bc1678e7d31144f320ae9f75fc58c742a2a64..caacce3725e2ef3803ea42d40 e77ceaeb7d7b914 100644--- a/drivers/rtc/rtc-zynqmp.c +++ b/drivers/rtc/rtc-zynqmp.c@@ -349,6 +349,11 @@ static int xlnx_rtc_probe(struct platform_device*pdev) xrtcdev->freq--; } + if (xrtcdev->freq > RTC_TICK_MASK) { + dev_err(&pdev->dev, "Invalid RTC calibration value\n"); + return -EINVAL; + } + ret = readl(xrtcdev->reg_base + RTC_CALIB_RD); if (!ret) writel(xrtcdev->freq, (xrtcdev->reg_base + RTC_CALIB_WR)); -- 2.47.3