linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kartik <kkartik@nvidia.com>
To: <andy.shevchenko@gmail.com>
Cc: <akpm@linux-foundation.org>, <andy@kernel.org>, <arnd@arndb.de>,
	<frank.li@vivo.com>, <jonathanh@nvidia.com>,
	<keescook@chromium.org>, <kkartik@nvidia.com>,
	<linux-hardening@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-mm@kvack.org>, <linux-tegra@vger.kernel.org>,
	<pdeschrijver@nvidia.com>, <petlozup@nvidia.com>,
	<pshete@nvidia.com>, <robh@kernel.org>, <stefank@nvidia.com>,
	<thierry.reding@gmail.com>, <ulf.hansson@linaro.org>
Subject: Re: [PATCH v4 1/8] mm/util: Introduce kmemdup_array() to duplicate an array
Date: Wed, 11 Oct 2023 21:43:59 +0530	[thread overview]
Message-ID: <20231011161359.1368-1-kkartik@nvidia.com> (raw)
In-Reply-To: <CAHp75VdBh0k_XU3GG99EvgLOztOFWn87QXknpokcDy=29yu=Aw@mail.gmail.com>

On Wed, 2023-10-11 at 18:36:11 +0300, Andy Shevchenko wrote:
> On Wed, Oct 11, 2023 at 2:17 PM Kartik <kkartik@nvidia.com> wrote:
> >
> > Introduce function kmemdup_array(), that will copy `n` number of
> > elements from a given array `src` to `dst`.
> >
> > On success, kmemdup_array() returns 0 and copy the elements from `src`
> > to newly allocated array `dst`, it also stores number of elements
> > copied from `src` array to `dst_count` parameter. On failure, this
> > returns a negative integer value containing the error value.
> 
> Hmm... Why is it so complicated?
> 
> Can it be as simple as
> 
>   return kmemdup(size_mul());
> 
> ?
> 
> --
> With Best Regards,
> Andy Shevchenko

The idea was to validate the arguments that are passed to kmemdup_array().
But I agree doing so complicates things here.

I will update this in the next patchset.

Thanks & Regards,
Kartik


  reply	other threads:[~2023-10-11 16:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-11  9:34 [PATCH v4 0/8] soc/tegra: fuse: Add ACPI support Kartik
2023-10-11  9:34 ` [PATCH v4 1/8] mm/util: Introduce kmemdup_array() to duplicate an array Kartik
2023-10-11 15:36   ` Andy Shevchenko
2023-10-11 16:13     ` Kartik [this message]
2023-10-11  9:34 ` [PATCH v4 2/8] soc/tegra: fuse: Use dev_err_probe for probe failures Kartik
2023-10-11  9:34 ` [PATCH v4 3/8] soc/tegra: fuse: Refactor resource mapping Kartik
2023-10-11  9:34 ` [PATCH v4 4/8] soc/tegra: fuse: Add tegra_acpi_init_apbmisc() Kartik
2023-10-11  9:34 ` [PATCH v4 5/8] soc/tegra: fuse: Add function to add lookups Kartik
2023-10-11  9:34 ` [PATCH v4 6/8] soc/tegra: fuse: Add function to print SKU info Kartik
2023-10-11  9:34 ` [PATCH v4 7/8] soc/tegra: fuse: Add ACPI support for Tegra194 and Tegra234 Kartik
2023-10-12 18:59   ` kernel test robot
2023-10-11  9:34 ` [PATCH v4 8/8] soc/tegra: fuse: Add support for Tegra241 Kartik

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=20231011161359.1368-1-kkartik@nvidia.com \
    --to=kkartik@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=arnd@arndb.de \
    --cc=frank.li@vivo.com \
    --cc=jonathanh@nvidia.com \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=pdeschrijver@nvidia.com \
    --cc=petlozup@nvidia.com \
    --cc=pshete@nvidia.com \
    --cc=robh@kernel.org \
    --cc=stefank@nvidia.com \
    --cc=thierry.reding@gmail.com \
    --cc=ulf.hansson@linaro.org \
    /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