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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMRc=Mc07xHfvRrZMfZ9ELAs8+02OdWq+XaUfSfiw4a3fH1z6w@mail.gmail.com>
Date: Fri, 25 Oct 2024 09:33:56 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Kent Gibson <warthog618@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>, linux-gpio@...r.kernel.org, 
	linux-kernel@...r.kernel.org, 
	Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH 1/5] gpio: sysfs: use cleanup guards for gpiod_data::mutex

On Fri, Oct 25, 2024 at 4:54 AM Kent Gibson <warthog618@...il.com> wrote:
>
> > @@ -140,7 +133,7 @@ static ssize_t value_store(struct device *dev,
> >
> >       status = kstrtol(buf, 0, &value);
> >
> > -     mutex_lock(&data->mutex);
> > +     guard(mutex)(&data->mutex);
> >
> >       if (!test_bit(FLAG_IS_OUT, &desc->flags)) {
> >               status = -EPERM;
> > @@ -149,8 +142,6 @@ static ssize_t value_store(struct device *dev,
> >               status = size;
> >       }
> >
> > -     mutex_unlock(&data->mutex);
> > -
> >       return status;
> >  }
>
>
> With the guard, this can be further simplified by returning immediately
> and collapsing the if-else chain:
>

Ah, right, it's the whole goal of this change after all.

Bart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ