From: sashiko-bot@kernel.org
To: "Markus Probst" <markus.probst@posteo.de>
Cc: "Alexandre Belloni" <alexandre.belloni@bootlin.com>,
robh@kernel.org, linux-rtc@vger.kernel.org, conor+dt@kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2 3/5] rtc: s35390a: Fix alarm not disabling
Date: Sat, 01 Aug 2026 18:55:28 +0000 [thread overview]
Message-ID: <20260801185528.998C01F00AC4@smtp.kernel.org> (raw)
In-Reply-To: <20260801-rtc_s35390a_int1-v2-3-f10c99ad1d6c@posteo.de>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Uninitialized stack memory usage in `s35390a_rtc_alarm_irq_enable` corrupts the RTC hardware state and cached alarm time.
--
--- Patch [3]: [PATCH v2 3/5] rtc: s35390a: Fix alarm not disabling ---
commit 14759f80e44e19699052dca75586c20731eb4d5d
Author: Markus Probst <markus.probst@posteo.de>
rtc: s35390a: Fix alarm not disabling
This commit implements the alarm_irq_enable callback to disable the alarm if
requested. It also restores the last used alarm time when the alarm is
re-enabled.
> diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
> index 4cfe7034c5165..fbf5471eb3d0b 100644
> --- a/drivers/rtc/rtc-s35390a.c
> +++ b/drivers/rtc/rtc-s35390a.c
[ ... ]
> @@ -379,6 +383,19 @@ static int s35390a_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
> return 0;
> }
>
> +static int s35390a_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
> +{
> + struct s35390a *s35390a = dev_get_drvdata(dev);
> + struct rtc_wkalrm alm;
> +
> + alm.enabled = enabled;
> +
> + if (enabled)
> + alm.time = s35390a->tm_alarm;
> +
> + return s35390a_rtc_set_alarm(dev, &alm);
> +}
[Severity: High]
When s35390a_rtc_alarm_irq_enable() is called with enabled == 0, the alm.time
field remains uninitialized on the stack.
Since alm is passed to s35390a_rtc_set_alarm(), won't the uninitialized
alm.time be read by the dev_dbg() call at the start of that function?
Additionally, does this uninitialized memory overwrite the cached alarm time?
Looking at the earlier changes to s35390a_rtc_set_alarm():
s35390a_rtc_set_alarm()
...
if (!err)
s35390a->tm_alarm = alm->time;
It appears the uninitialized stack memory can be assigned to s35390a->tm_alarm,
which would permanently corrupt the cache. When the alarm is subsequently
re-enabled, this corrupted time would then be restored and written to the
hardware.
Could this be resolved by zero-initializing the alm structure?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260801-rtc_s35390a_int1-v2-0-f10c99ad1d6c@posteo.de?part=3
next prev parent reply other threads:[~2026-08-01 18:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-01 18:42 [PATCH v2 0/5] rtc: s35390a: Allow use of output pin for interrupt signal 1 for wakealarm Markus Probst
2026-08-01 18:43 ` [PATCH v2 1/5] dt-bindings: rtc: Add pinctrl for S35390A Markus Probst
2026-08-01 18:51 ` sashiko-bot
2026-08-01 18:43 ` [PATCH v2 2/5] rtc: s35390a: Add missing newline to dev_err Markus Probst
2026-08-01 18:46 ` sashiko-bot
2026-08-01 18:43 ` [PATCH v2 3/5] rtc: s35390a: Fix alarm not disabling Markus Probst
2026-08-01 18:55 ` sashiko-bot [this message]
2026-08-01 22:06 ` Alexandre Belloni
2026-08-01 18:43 ` [PATCH v2 4/5] rtc: s35390a: Add pinctrl Markus Probst
2026-08-01 18:58 ` sashiko-bot
2026-08-01 18:43 ` [PATCH v2 5/5] rtc: s35390a: Add synology quirk Markus Probst
2026-08-01 18:52 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260801185528.998C01F00AC4@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=markus.probst@posteo.de \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).