All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: rtc-linux@googlegroups.com,
	Alessandro Zummo <a.zummo@towertech.it>,
	Support Opensource <support.opensource@diasemi.com>
Subject: [rtc-linux] Re: [PATCH] rtc-da9063: avoid writing undefined data to rtc
Date: Mon, 30 Nov 2015 20:07:54 +0100	[thread overview]
Message-ID: <20151130190754.GQ22136@piout.net> (raw)
In-Reply-To: <1448625775-15531-1-git-send-email-enrico.scholz@sigma-chemnitz.de>

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 <enrico.scholz@sigma-chemnitz.de>
> ---
>  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.

      parent reply	other threads:[~2015-11-30 19:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 12:02 [rtc-linux] [PATCH] rtc-da9063: avoid writing undefined data to rtc Enrico Scholz
2015-11-27 15:01 ` [rtc-linux] " Alexandre Belloni
2015-11-27 15:27   ` Enrico Scholz
2015-11-27 15:57     ` Alexandre Belloni
2015-11-30  2:47       ` Opensource [Steve Twiss]
2015-11-30 14:32       ` Opensource [Steve Twiss]
2015-11-30 19:07 ` Alexandre Belloni [this message]

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=20151130190754.GQ22136@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=a.zummo@towertech.it \
    --cc=enrico.scholz@sigma-chemnitz.de \
    --cc=rtc-linux@googlegroups.com \
    --cc=support.opensource@diasemi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.