Re: [PATCH v1 1/2] pinctrl: Duplicate user memory in one go in pinmux_select()

From: Linus Walleij
Date: Fri Jun 09 2023 - 03:22:34 EST


On Sun, Jun 4, 2023 at 3:12 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:

> Current code is suboptimal in three ways:
> 1) it explicitly terminates the string which is not needed;
> 2) it might provoke additional faults, because asked lenght might be
> bigger than the real one;
> 3) it consumes more than needed lines in the source.
>
> Instead of using kmalloc() + strncpy_from_user() + terminating, just
> utilize memdup_user_nul().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

Excellent patch, applied!

Yours,
Linus Walleij