summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds1305.c
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2015-11-27 13:02:55 +0100
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2016-01-11 20:19:57 +0100
commit2ad2c17480b6208a35a4ffb937effe0ba1ed39de (patch)
treee109844dc37c39388e02ed452609994ab3b50889 /drivers/rtc/rtc-ds1305.c
parent4d833d601332b00a1ef5f0249e97481d02f3ad02 (diff)
downloadlinux-2ad2c17480b6208a35a4ffb937effe0ba1ed39de.tar.gz
linux-2ad2c17480b6208a35a4ffb937effe0ba1ed39de.tar.bz2
linux-2ad2c17480b6208a35a4ffb937effe0ba1ed39de.zip
rtc: da9063: avoid writing undefined data to rtc
driver did | static void da9063_tm_to_data(struct rtc_time *tm, u8 *data, | { | const struct da9063_compatible_rtc_regmap *config = rtc->config; | | data[RTC_SEC] &= ~config->rtc_count_sec_mask; | data[RTC_SEC] |= tm->tm_sec & config->rtc_count_sec_mask; | ... | } | ... | static int da9063_rtc_set_time(struct device *dev, struct rtc_time *tm) | { | ... | u8 data[RTC_DATA_LEN]; | int ret; | | da9063_tm_to_data(tm, data, rtc); which means that some bits of stack content (in 'data[]') was masked out and written to the RTC. Because da9063_tm_to_data() is used only by da9063_rtc_set_time() and da9063_rtc_set_alarm(), we can write fields directly. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Acked-by: Steve Twiss <stwiss.opensource@diasemi.com> Tested-by: Steve Twiss <stwiss.opensource@diasemi.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc/rtc-ds1305.c')
0 files changed, 0 insertions, 0 deletions