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 06:37:05PM +0300, Dan Carpenter wrote:
> 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

Ah that's a fair point, I can see how involved that would be to set up a
wrapper and handle the various paths correctly. The marginal benefit
just doesn't seem worth the effort afterall.

William Breathitt Gray

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux