All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: "Sonawane, Aashish P" <AashishPSonawane@eaton.com>
Cc: "a.zummo@towertech.it" <a.zummo@towertech.it>,
	"alexandre.belloni@free-electrons.com" 
	<alexandre.belloni@free-electrons.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"Saitwal, Meghan" <MeghanSaitwal@eaton.com>
Subject: Re: [PATCH] rtc : Restricting year setting between 2000 to 2099 in rtc-s35390a driver
Date: Wed, 4 Sep 2019 13:57:33 +0200	[thread overview]
Message-ID: <20190904115733.GA9993@kroah.com> (raw)
In-Reply-To: <29075B3123F59F41878316669231A55F0A9ED945@SIMTCSMB12.napa.ad.etn.com>

On Wed, Sep 04, 2019 at 11:20:26AM +0000, Sonawane, Aashish P wrote:
> 
> S-35390A RTC chip allows to set the lower two digit of the Western calendar year (00 to 99) and links together with the auto calendar from the year 2000 to the year 2099. If we try to set year earlier than 2000 then hardware clock get reset to "epoch". This patch check for year value between 2000 to 2099 otherwise returns "EINVAL" error. In conclusion this patch restricts system to set hardware clock to set year below and above the year 2000 and 2099 respectively.
> 
> Signed-off-by: Aashish P Sonawane mailto:AashishPSonawane@eaton.com
> Suggested-by: Meghan Saitwal mailto:MeghanSaitwal@eaton.com
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
> index 84806ff763cf..aea52548571e 100644
> --- a/drivers/rtc/rtc-s35390a.c
> +++ b/drivers/rtc/rtc-s35390a.c
> @@ -214,6 +214,9 @@ static int s35390a_rtc_set_time(struct device *dev, struct rtc_time *tm)
>  	int i, err;
>  	char buf[7], status;
>  
> +	if (tm->tm_year < 100 || tm->tm_year > 199)
> +		return EINVAL;
> +
>  	dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d mday=%d, "
>  		"mon=%d, year=%d, wday=%d\n", __func__, tm->tm_sec,
>  		tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon, tm->tm_year,

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

      reply	other threads:[~2019-09-04 11:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 11:20 [PATCH] rtc : Restricting year setting between 2000 to 2099 in rtc-s35390a driver Sonawane, Aashish P
2019-09-04 11:57 ` Greg KH [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=20190904115733.GA9993@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=AashishPSonawane@eaton.com \
    --cc=MeghanSaitwal@eaton.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=stable@vger.kernel.org \
    /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.