rockchip: fix stack overflow in rk8xx_rtc

Presumably surfaced by -fstack-protector-strong, rk8xx_settime was
triggering SSP when ntpd set the time on the RockPro64, at the very
least.  A minor oops meant that the weeks mask was getting tossed into
the wrong field, and the mask was never populated.  The mask is 0x7 for
all three of these, thus overflowing the `data` array in settime by one
byte.

PR:		296719
Reported by:	jsm, "Tenkawa" on Discord
Reviewed by:	mmel
Differential Revision:	https://reviews.freebsd.org/D58182
This commit is contained in:
Kyle Evans committed 2026-07-12 09:51:05 -05:00
1 parent f72cfefae9
commit d387a43ec8
3 files changed
+6 -3

No files matched your search

+2 -1
View File
@@ -167,7 +167,8 @@ rk805_attach(device_t dev)
sc->rtc_regs.months = RK805_RTC_MONTHS;
sc->rtc_regs.months_mask = RK805_RTC_MONTHS_MASK;
sc->rtc_regs.years = RK805_RTC_YEARS;
sc->rtc_regs.weeks = RK805_RTC_WEEKS_MASK;
sc->rtc_regs.weeks = RK805_RTC_WEEKS;
sc->rtc_regs.weeks_mask = RK805_RTC_WEEKS_MASK;
sc->rtc_regs.ctrl = RK805_RTC_CTRL;
sc->rtc_regs.ctrl_stop_mask = RK805_RTC_CTRL_STOP;
sc->rtc_regs.ctrl_ampm_mask = RK805_RTC_AMPM_MODE;
+2 -1
View File
@@ -242,7 +242,8 @@ rk808_attach(device_t dev)
sc->rtc_regs.months = RK808_RTC_MONTHS;
sc->rtc_regs.months_mask = RK808_RTC_MONTHS_MASK;
sc->rtc_regs.years = RK808_RTC_YEARS;
sc->rtc_regs.weeks = RK808_RTC_WEEKS_MASK;
sc->rtc_regs.weeks = RK808_RTC_WEEKS;
sc->rtc_regs.weeks_mask = RK808_RTC_WEEKS_MASK;
sc->rtc_regs.ctrl = RK808_RTC_CTRL;
sc->rtc_regs.ctrl_stop_mask = RK808_RTC_CTRL_STOP;
sc->rtc_regs.ctrl_ampm_mask = RK808_RTC_AMPM_MODE;
+2 -1
View File
@@ -498,7 +498,8 @@ rk817_attach(device_t dev)
sc->rtc_regs.months = RK817_RTC_MONTHS;
sc->rtc_regs.months_mask = RK817_RTC_MONTHS_MASK;
sc->rtc_regs.years = RK817_RTC_YEARS;
sc->rtc_regs.weeks = RK817_RTC_WEEKS_MASK;
sc->rtc_regs.weeks = RK817_RTC_WEEKS;
sc->rtc_regs.weeks_mask = RK817_RTC_WEEKS_MASK;
sc->rtc_regs.ctrl = RK817_RTC_CTRL;
sc->rtc_regs.ctrl_stop_mask = RK817_RTC_CTRL_STOP;
sc->rtc_regs.ctrl_ampm_mask = RK817_RTC_AMPM_MODE;