lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 22 Oct 2019 09:50:20 +0200
From:   Enric Balletbo i Serra <enric.balletbo@...labora.com>
To:     Alexandre Belloni <alexandre.belloni@...tlin.com>,
        linux-rtc@...r.kernel.org
Cc:     Benson Leung <bleung@...omium.org>,
        Guenter Roeck <groeck@...omium.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] rtc: cros-ec: let the core handle rtc range

Hi Alexandre,

On 16/10/19 22:14, Alexandre Belloni wrote:
> Let the rtc core check the date/time against the RTC range.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@...tlin.com>

Tested on few devices just to make sure nothing is broken, the change looks good
to me and works as expected.

Reviewed-by: Enric Balletbo i Serra <enric.balletbo@...labora.com>


> ---
>  drivers/rtc/rtc-cros-ec.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-cros-ec.c b/drivers/rtc/rtc-cros-ec.c
> index da209d00731e..d043d30f05bc 100644
> --- a/drivers/rtc/rtc-cros-ec.c
> +++ b/drivers/rtc/rtc-cros-ec.c
> @@ -107,11 +107,7 @@ static int cros_ec_rtc_set_time(struct device *dev, struct rtc_time *tm)
>  	struct cros_ec_rtc *cros_ec_rtc = dev_get_drvdata(dev);
>  	struct cros_ec_device *cros_ec = cros_ec_rtc->cros_ec;
>  	int ret;
> -	time64_t time;
> -
> -	time = rtc_tm_to_time64(tm);
> -	if (time < 0 || time > U32_MAX)
> -		return -EINVAL;
> +	time64_t time = rtc_tm_to_time64(tm);
>  
>  	ret = cros_ec_rtc_set(cros_ec, EC_CMD_RTC_SET_VALUE, (u32)time);
>  	if (ret < 0) {
> @@ -348,12 +344,17 @@ static int cros_ec_rtc_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>  
> -	cros_ec_rtc->rtc = devm_rtc_device_register(&pdev->dev, DRV_NAME,
> -						    &cros_ec_rtc_ops,
> -						    THIS_MODULE);
> +	cros_ec_rtc->rtc = devm_rtc_allocate_device(&pdev->dev);
>  	if (IS_ERR(cros_ec_rtc->rtc))
>  		return PTR_ERR(cros_ec_rtc->rtc);
>  
> +	cros_ec_rtc->rtc->ops = &cros_ec_rtc_ops;
> +	cros_ec_rtc->rtc->range_max = U32_MAX;
> +
> +	ret = rtc_register_device(cros_ec_rtc->rtc);
> +	if (ret)
> +		return ret;
> +
>  	/* Get RTC events from the EC. */
>  	cros_ec_rtc->notifier.notifier_call = cros_ec_rtc_event;
>  	ret = blocking_notifier_chain_register(&cros_ec->event_notifier,
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ