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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191120171512.GA28255@roeck-us.net>
Date:   Wed, 20 Nov 2019 09:15:12 -0800
From:   Guenter Roeck <linux@...ck-us.net>
To:     "Wang, Peng 1. (NSB - CN/Hangzhou)" <peng.1.wang@...ia-sbell.com>
Cc:     "wim@...ux-watchdog.org" <wim@...ux-watchdog.org>,
        "linux-watchdog@...r.kernel.org" <linux-watchdog@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] watchdog: make DesignWare watchdog allow users to set
 bigger timeout value

On Wed, Nov 20, 2019 at 10:07:57AM +0000, Wang, Peng 1. (NSB - CN/Hangzhou) wrote:
> From 1d051b7c081083751dc0bab97d3ab9efbba0f4a7 Mon Sep 17 00:00:00 2001
> From: Peng Wang <peng.1.wang@...ia-sbell.com>
> Date: Wed, 20 Nov 2019 15:12:59 +0800
> Subject: [PATCH] watchdog: make DesignWare watchdog allow users to set bigger
>  timeout value
> 
> watchdog_dev.c provides means to allow users to set bigger timeout value
> than HW can support, make DesignWare watchdog align with this.
> 
> Signed-off-by: Peng Wang <peng.1.wang@...ia-sbell.com>
> ---
>  drivers/watchdog/dw_wdt.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c
> index fef7c61..8911e5e 100644
> --- a/drivers/watchdog/dw_wdt.c
> +++ b/drivers/watchdog/dw_wdt.c
> @@ -113,8 +113,15 @@ static int dw_wdt_set_timeout(struct watchdog_device *wdd, unsigned int top_s)
>  	 */
>  	writel(top_val | top_val << WDOG_TIMEOUT_RANGE_TOPINIT_SHIFT,
>  	       dw_wdt->regs + WDOG_TIMEOUT_RANGE_REG_OFFSET);
> -
> -	wdd->timeout = dw_wdt_top_in_seconds(dw_wdt, top_val);
> +    
> +    /*
> +     * In case users set bigger timeout value than HW can support,
> +     * kernel(watchdog_dev.c) helps to feed watchdog before 
> +     * wdd->timeout
> +     */
> +    if ( wdd->timeout * 1000 <= wdd->max_hw_heartbeat_ms ) {
> +	    wdd->timeout = dw_wdt_top_in_seconds(dw_wdt, top_val);
> +    }

{ } is unnecessary here. Also, the above code compares the _old_
timeout againt the maximum supported timeout, which doesn't look
correct.

Thanks,
Guenter

>  
>  	return 0;
>  }
> -- 
> 1.8.3.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ