Re: [PATCH v5 2/4] kernel hacking: new config NO_AUTO_INLINE to disable compiler auto-inline optimizations

From: Johan Hovold
Date: Thu Jun 07 2018 - 05:18:38 EST


On Thu, Jun 07, 2018 at 02:40:25PM +0530, Viresh Kumar wrote:
> On 07-06-18, 11:03, Bernd Petrovitsch wrote:
> > On Thu, 2018-06-07 at 14:08 +0530, Viresh Kumar wrote:
> > > On 07-06-18, 15:46, Du, Changbin wrote:
> > > > I think if the destination is not a null terminated string (If I understand your
> > > > description below), memcpy can be used to get rid of such warning. The warning
> > > > makes sense in general as explained in mannual. Thanks!
> > >
> > > The destination should be a null terminated string eventually, but we first need
> > > to make sure src is a null terminated string.
> >
> > Is there strnlen() or memchr() in the kernel?
> > Then check the source before copying it.
>
> It would be extra work, but memchr can be used to work around this I believe.
>
> @Johan ??

If you want to work around the warning and think you can do it in some
non-contrived way, then go for it.

Clearing the request buffer, checking for termination using strnlen, and
then using memcpy might not be too bad.

But after all, it is a false positive, so leaving things as they stand
is fine too.

Thanks,
Johan