From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.free-electrons.com (down.free-electrons.com. [37.187.137.238]) by gmr-mx.google.com with ESMTP id e201si701028wma.3.2015.11.30.11.07.58 for ; Mon, 30 Nov 2015 11:07:58 -0800 (PST) Date: Mon, 30 Nov 2015 20:07:54 +0100 From: Alexandre Belloni To: Enrico Scholz Cc: rtc-linux@googlegroups.com, Alessandro Zummo , Support Opensource Subject: [rtc-linux] Re: [PATCH] rtc-da9063: avoid writing undefined data to rtc Message-ID: <20151130190754.GQ22136@piout.net> References: <1448625775-15531-1-git-send-email-enrico.scholz@sigma-chemnitz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 In-Reply-To: <1448625775-15531-1-git-send-email-enrico.scholz@sigma-chemnitz.de> Reply-To: rtc-linux@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , On 27/11/2015 at 13:02:55 +0100, Enrico Scholz wrote : > 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 > --- > drivers/rtc/rtc-da9063.c | 23 ++++++----------------- > 1 file changed, 6 insertions(+), 17 deletions(-) > Applied, thanks. -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/d/optout.