From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>
Cc: thierry.reding@gmail.com, jonathanh@nvidia.com, kees@kernel.org,
andy@kernel.org, akpm@linux-foundation.org,
linux-tegra@vger.kernel.org, linux-hardening@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH] mm/util: Swap kmemdup_array() arguments
Date: Thu, 6 Jun 2024 18:36:24 +0300 [thread overview]
Message-ID: <CAHp75VeUo=2kq7R1t8Bv9rWrkv0b20oMv1mPtJBM69rg+S3LRg@mail.gmail.com> (raw)
In-Reply-To: <20240606144608.97817-2-jean-philippe@linaro.org>
On Thu, Jun 6, 2024 at 5:47 PM Jean-Philippe Brucker
<jean-philippe@linaro.org> wrote:
>
> GCC 14.1 complains about the argument usage of kmemdup_array():
>
> drivers/soc/tegra/fuse/fuse-tegra.c:130:65: error: 'kmemdup_array' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
> 130 | fuse->lookups = kmemdup_array(fuse->soc->lookups, sizeof(*fuse->lookups),
> | ^
> drivers/soc/tegra/fuse/fuse-tegra.c:130:65: note: earlier argument should specify number of elements, later size of each element
>
> The annotation introduced by commit 7d78a7773355 ("string: Add
> additional __realloc_size() annotations for "dup" helpers") lets the
> compiler think that kmemdup_array() follows the same format as calloc(),
> with the number of elements preceding the size of one element. So we
> could simply swap the arguments to __realloc_size() to get rid of that
> warning, but it seems cleaner to instead have kmemdup_array() follow the
> same format as krealloc_array(), memdup_array_user(), calloc() etc.
LGTM, it seems we don't have many users (yet), this looks like a
comprehensive change.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-06-06 15:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 14:46 Jean-Philippe Brucker
2024-06-06 15:36 ` Andy Shevchenko [this message]
2024-06-06 15:55 ` Kees Cook
[not found] ` <CAHp75Vc-ALE=VDJs9062y-z5JW9_=z9axx2DL6B5ZeWD7zo-qQ@mail.gmail.com>
2024-06-06 17:46 ` Kees Cook
2024-06-06 17:48 ` Andy Shevchenko
2024-06-06 18:10 ` Kees Cook
2024-06-06 18:45 ` Andy Shevchenko
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='CAHp75VeUo=2kq7R1t8Bv9rWrkv0b20oMv1mPtJBM69rg+S3LRg@mail.gmail.com' \
--to=andy.shevchenko@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andy@kernel.org \
--cc=jean-philippe@linaro.org \
--cc=jonathanh@nvidia.com \
--cc=kees@kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@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