lkml.org 
[lkml]   [2023]   [Oct]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v4 1/8] mm/util: Introduce kmemdup_array() to duplicate an array
Date
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

\
 
 \ /
  Last update: 2023-10-11 18:14    [W:0.053 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site