Re: [PATCH] counter: rz-mtu3-cnt: Unlock on error in rz_mtu3_count_write()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 19, 2023 at 10:36:49AM -0400, William Breathitt Gray wrote:
> The lock is acquired by rz_mtu3_lock_if_counter_is_valid(), so that
> function needs a sparse __acquires(&priv->lock) annotation too.

I found this bug using Smatch.  It's a competing static checker which
uses Sparse as a parser.  I am the author of Smatch so I am naturally
biased.

I don't think it's as simple as that.  I don't think Sparse has
annotations for mutexes, only for spinlocks?  Also it's really
complicated to annotate something as taking the lock on the success path
but not on the failure path.  You have to set up a wrapper and use
__cond_lock().

Every other feature in Sparse is awesome, but for locking, it's better
to just use Smatch.

regards,
dan carpenter



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux