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]
Date:   Wed, 22 Nov 2023 06:58:41 -0800
From:   Guenter Roeck <linux@...ck-us.net>
To:     Ben Dooks <ben.dooks@...ethink.co.uk>,
        linux-watchdog@...r.kernel.org
Cc:     wim@...ux-watchdog.org, samin.guo@...rfivetech.com,
        xingyu.wu@...rfivetech.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] watchdog: starfive: add lock annotations to fix context
 imbalances

On 11/22/23 00:51, Ben Dooks wrote:
> Add the necessary __acquires() and __releases() to the functions
> that take and release the wdt lock to avoid the following sparse
> warnings:
> 
> drivers/watchdog/starfive-wdt.c:204:13: warning: context imbalance in 'starfive_wdt_unlock' - wrong count at exit
> drivers/watchdog/starfive-wdt.c:212:9: warning: context imbalance in 'starfive_wdt_lock' - unexpected unlock
> 
> Signed-off-by: Ben Dooks <ben.dooks@...ethink.co.uk>

Reviewed-by: Guenter Roeck <linux@...ck-us.net>

> ---
>   drivers/watchdog/starfive-wdt.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
> index 5f501b41faf9..49b38ecc092d 100644
> --- a/drivers/watchdog/starfive-wdt.c
> +++ b/drivers/watchdog/starfive-wdt.c
> @@ -202,12 +202,14 @@ static u32 starfive_wdt_ticks_to_sec(struct starfive_wdt *wdt, u32 ticks)
>   
>   /* Write unlock-key to unlock. Write other value to lock. */
>   static void starfive_wdt_unlock(struct starfive_wdt *wdt)
> +	__acquires(&wdt->lock)
>   {
>   	spin_lock(&wdt->lock);
>   	writel(wdt->variant->unlock_key, wdt->base + wdt->variant->unlock);
>   }
>   
>   static void starfive_wdt_lock(struct starfive_wdt *wdt)
> +	__releases(&wdt->lock)
>   {
>   	writel(~wdt->variant->unlock_key, wdt->base + wdt->variant->unlock);
>   	spin_unlock(&wdt->lock);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ