From: Tomas Melin Date: Thu, 22 Jan 2026 13:53:46 +0000 (+0000) Subject: rtc: zynqmp: check calibration max value X-Git-Tag: v7.0-rc1~6^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83b9e5eb043710190f6461729fa2e05320a6594d;p=thirdparty%2Flinux.git rtc: zynqmp: check calibration max value Enable check to not overflow the calibration max value. Reviewed-by: Harini T Tested-by: Harini T Signed-off-by: Tomas Melin Acked-by: Michal Simek Link: https://patch.msgid.link/20260122-zynqmp-rtc-updates-v4-2-d4edb966b499@vaisala.com Signed-off-by: Alexandre Belloni --- diff --git a/drivers/rtc/rtc-zynqmp.c b/drivers/rtc/rtc-zynqmp.c index 856bc1678e7d..caacce3725e2 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));