Re: [PATCH v4] drivers/iio: Remove all strcpy() uses

From: Jonathan Cameron
Date: Sun Aug 15 2021 - 11:56:45 EST


On Sun, 15 Aug 2021 15:45:55 +0100
Jonathan Cameron <jic23@xxxxxxxxxx> wrote:

> On Sun, 15 Aug 2021 10:19:49 +0200
> Len Baker <len.baker@xxxxxxx> wrote:
>
> > Hi Andy,
> >
> > On Sat, Aug 14, 2021 at 10:36:18PM +0300, Andy Shevchenko wrote:
> > > On Sat, Aug 14, 2021 at 4:55 PM Len Baker <len.baker@xxxxxxx> wrote:
> > > >
> > > > strcpy() performs no bounds checking on the destination buffer. This
> > > > could result in linear overflows beyond the end of the buffer, leading
> > > > to all kinds of misbehaviors. So, remove all the uses and add
> > > > devm_kstrdup() or devm_kasprintf() instead.
> > > >
> > > > This patch is an effort to clean up the proliferation of str*()
> > > > functions in the kernel and a previous step in the path to remove
> > > > the strcpy function from the kernel entirely [1].
> > > >
> > > > [1] https://github.com/KSPP/linux/issues/88
> > >
> > > Thank you very much for doing this!
> > > Now I like the result,
> Agreed and applied to the togreg branch of iio.git, pushed out as testing
> for 0-day to poke at it and see if we missed anything.

Dropped it for now so that Joe's comment can be addressed / discussed.

Jonathan

>
> Thanks,
>
> Jonathan
> > > Reviewed-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
>
> >
> > Thank you too Andy (and folks) for your help on this.
> >
> > Regards,
> > Len
>