mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Kent Gibson <warthog618@gmail.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH 1/2] gpio: sim: fix an invalid __free() usage
Date: Sat, 16 Sep 2023 14:19:18 +0300	[thread overview]
Message-ID: <ZQWPNrrGLwfEj1tj@smile.fi.intel.com> (raw)
In-Reply-To: <20230915123423.75948-1-brgl@bgdev.pl>

On Fri, Sep 15, 2023 at 02:34:22PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.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



      parent reply	other threads:[~2023-09-16 11:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 12:34 Bartosz Golaszewski
2023-09-15 12:34 ` [PATCH 2/2] gpio: sim: include a missing header Bartosz Golaszewski
2023-09-16 11:19 ` Andy Shevchenko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZQWPNrrGLwfEj1tj@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=adobriyan@gmail.com \
    --cc=bartosz.golaszewski@linaro.org \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=warthog618@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®