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] [day] [month] [year] [list]
Message-ID: <CAMRc=MfvE+NeYwTTSLvZX-9=iqsMENZWec7WmxcgKDkNEPEn9A@mail.gmail.com>
Date:   Mon, 25 Sep 2023 08:42:22 +0200
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Linus Walleij <linus.walleij@...aro.org>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Kent Gibson <warthog618@...il.com>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        akpm@...ux-foundation.org
Cc:     linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
        Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v2 2/2] gpio: sim: initialize a managed pointer when
 declaring it

On Sun, Sep 17, 2023 at 10:58 AM Bartosz Golaszewski <brgl@...ev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>
> Variables managed with __free() should typically be initialized where
> they are declared so that the __free() callback is paired with its
> counterpart resource allocator. Fix the second instance of using
> __free() in gpio-sim to follow this pattern.
>
> Fixes: 3faf89f27aab ("gpio: sim: simplify code with cleanup helpers")
> Suggested-by: Linus Torvalds <torvalds@...ux-foundation.org>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> ---
>  drivers/gpio/gpio-sim.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
> index 4d74ea3a4269..24c19c7c50a0 100644
> --- a/drivers/gpio/gpio-sim.c
> +++ b/drivers/gpio/gpio-sim.c
> @@ -1481,10 +1481,10 @@ static const struct config_item_type gpio_sim_device_config_group_type = {
>  static struct config_group *
>  gpio_sim_config_make_device_group(struct config_group *group, const char *name)
>  {
> -       struct gpio_sim_device *dev __free(kfree) = NULL;
>         int id;
>
> -       dev = kzalloc(sizeof(*dev), GFP_KERNEL);
> +       struct gpio_sim_device *dev __free(kfree) = kzalloc(sizeof(*dev),
> +                                                           GFP_KERNEL);
>         if (!dev)
>                 return ERR_PTR(-ENOMEM);
>
> --
> 2.39.2
>

Queued for v6.7.

Bartosz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ