From: sashiko-bot@kernel.org
To: Johnny.Fan <johnny.fan@cixtech.com>
Cc: linux-rtc@vger.kernel.org,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>
Subject: Re: [PATCH v2] rtc: efi: restore alarm support with runtime capability probe
Date: Mon, 31 Aug 2026 11:56:58 +0000 [thread overview]
Message-ID: <20260831115659.2AD7B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260831113858.759210-1-johnny.fan@cixtech.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Zero-initializing `eft` in `efi_read_alarm()` guarantees an `-EIO` failure when reading disabled alarms, breaking user-space reads.
--
commit f9829a03fcbfff469b82ea3dd308ff1029bfea0e
Author: Johnny.Fan <Johnny.Fan@cixtech.com>
rtc: efi: restore alarm support with runtime capability probe
This commit restores the EFI RTC alarm functionality and procfs output that
was previously removed. It introduces a runtime probe of the wakeup
capability to avoid exposing a broken alarm if the service is unsupported.
> diff --git a/drivers/rtc/rtc-efi.c b/drivers/rtc/rtc-efi.c
> index b4f44999ef0f4..5276870b410e0 100644
> --- a/drivers/rtc/rtc-efi.c
> +++ b/drivers/rtc/rtc-efi.c
[ ... ]
> @@ -112,6 +113,35 @@ convert_from_efi_time(efi_time_t *eft, struct rtc_time *wtime)
> return true;
> }
>
> +static int efi_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
> +{
> + efi_time_t eft;
> + efi_status_t status;
> +
> + memset(&eft, 0, sizeof(eft));
> + status = efi.get_wakeup_time((efi_bool_t *)&wkalrm->enabled,
> + (efi_bool_t *)&wkalrm->pending, &eft);
> + if (status != EFI_SUCCESS)
> + return -EINVAL;
> +
> + if (!convert_from_efi_time(&eft, &wkalrm->time))
> + return -EIO;
[Severity: High]
Does this return -EIO for disabled alarms?
When a user queries the RTC alarm via the standard ioctl interface,
efi_read_alarm() zero-initializes eft before calling efi.get_wakeup_time().
Per the UEFI specification, if the alarm is disabled, the time output is
undefined and the firmware may leave eft unmodified.
Because eft is all zeroes, its day field is 0. The convert_from_efi_time()
function strictly validates the time, rejecting day == 0, and returns false:
drivers/rtc/rtc-efi.c:convert_from_efi_time() {
...
if (!eft->day || eft->day > 31)
return false;
...
}
Will this cause efi_read_alarm() to return -EIO to the subsystem, propagating
the error to userspace instead of correctly reporting the alarm as disabled,
and potentially breaking expected functionality for standard userspace tools
like rtcwake and hwclock?
> +
> + return rtc_valid_tm(&wkalrm->time);
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260831113858.759210-1-johnny.fan@cixtech.com?part=1
next prev parent reply other threads:[~2026-08-31 11:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 3:15 [PATCH] rtc: efi: restore alarm support with runtime capability probe Johnny.Fan
2026-08-28 3:32 ` sashiko-bot
2026-08-28 7:26 ` Ard Biesheuvel
2026-08-28 8:23 ` Johnny Fan
2026-08-28 8:32 ` Johnny Fan
2026-08-28 10:13 ` Ard Biesheuvel
2026-08-28 12:48 ` Alexandre Belloni
2026-08-31 1:10 ` Feng Tang
2026-08-31 11:38 ` [PATCH v2] " Johnny.Fan
2026-08-31 11:56 ` sashiko-bot [this message]
2026-08-31 13:34 ` Ard Biesheuvel
2026-08-31 14:00 ` [PATCH v3] " Johnny.Fan
2026-08-31 17:47 ` 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=20260831115659.2AD7B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=johnny.fan@cixtech.com \
--cc=linux-rtc@vger.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