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: <20250614130132.220f5f16@jic23-huawei>
Date: Sat, 14 Jun 2025 13:01:32 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Andrew Ijano <andrew.ijano@...il.com>
Cc: andrew.lopes@...mni.usp.br, gustavobastos@....br, dlechner@...libre.com,
 nuno.sa@...log.com, andy@...nel.org, jstephan@...libre.com,
 linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 3/3] iio: accel: sca3000: use guard(mutex)() for
 handling mutex lock

On Wed, 11 Jun 2025 16:39:21 -0300
Andrew Ijano <andrew.ijano@...il.com> wrote:

> Use guard(mutex)(&st->lock) for handling mutex lock instead of
> manually locking and unlocking the mutex. This prevents forgotten
> locks due to early exits and remove the need of gotos.
> 
> Signed-off-by: Andrew Ijano <andrew.lopes@...mni.usp.br>
> Co-developed-by: Gustavo Bastos <gustavobastos@....br>
> Signed-off-by: Gustavo Bastos <gustavobastos@....br>
> Suggested-by: Jonathan Cameron <jic23@...nel.org>
> ---
> For this one, there are two cases where the previous implementation
> was a smalllocking portion of the code and now it's locking the whole
> function. I don't know if this is a desired behavior.

I'd call out more specifically that you are going from

lock
stuff
unlock
call which contains lock over whole useful scope

to
lock
stuff
call with lock no longer done inside
unlock

In at least one case.  Looks cleaner to me. I'd guess this is a silly
bit of code evolution that you are tidying up as that lock dance looks
pointless to me.

Otherwise just the {} for cases thing needs fixing up.

Jonathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ