[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZQWPNrrGLwfEj1tj@smile.fi.intel.com>
Date: Sat, 16 Sep 2023 14:19:18 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Linus Walleij <linus.walleij@...aro.org>,
Kent Gibson <warthog618@...il.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH 1/2] gpio: sim: fix an invalid __free() usage
On Fri, Sep 15, 2023 at 02:34:22PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>
> gpio_sim_make_line_names() returns NULL or ERR_PTR() so we must not use
> __free(kfree) on the returned address. Let's rework the function so that
> it returns the size of the gpio-line-names array or a negative error
> code on failure. This way we know that the string array will either stay
> NULL or be set to a correct, kcalloc()'ed address.
...
> + names = kcalloc(line_names_size, sizeof(*line_names), GFP_KERNEL);
sizeof(*line_names) is a bit unusual here. names is typed as double pointer,
while line_names as a tripple one.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists