[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210731134303.GA1979@titan>
Date: Sat, 31 Jul 2021 15:43:03 +0200
From: Len Baker <len.baker@....com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Len Baker <len.baker@....com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Phil Reid <preid@...ctromag.com.au>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
dri-devel <dri-devel@...ts.freedesktop.org>,
"open list:FRAMEBUFFER LAYER" <linux-fbdev@...r.kernel.org>,
linux-staging@...ts.linux.dev,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/3] staging/fbtft: Remove all strcpy() uses
On Sun, Jul 25, 2021 at 09:51:18PM +0300, Andy Shevchenko wrote:
> On Sun, Jul 25, 2021 at 4:59 PM Len Baker <len.baker@....com> wrote:
> > On Sat, Jul 24, 2021 at 11:21:04PM +0300, Andy Shevchenko wrote:
> > > On Sat, Jul 24, 2021 at 7:05 PM Len Baker <len.baker@....com> wrote:
>
> ...
>
> > > > - char msg[128];
> > >
> > > 128 / 4 = 32. So, this buffer is enough to debug print only up to 32
> > > bytes. Hence %*ph replacement won't cut output earlier than requested.
> >
> > I'm sorry, but I don't understand what you are trying to explain. Moreover,
> > with the "0x%02X " in the sprintf followed by the strcat, the msg buffer can
> > print 128/5 values (25 hex values).
> >
> > The %*ph replacement can print up to 64 bytes, so I don't see any problem
> > here.
>
> Right. That's what I am trying to say and the hint here is to combine
> this part into a phrase in the commit message in the next version of
> the patch.
Ok, I will update the commit changelog for the next version.
>
> ...
>
> > > > + for (j = i + 1; par->init_sequence[j] >= 0; j++);
> > >
> > > Why is i + 1 initial for the j? You may rather access the 'i + 1 +
> > > j'th element in the array...
> > >
> > > ...
> > >
> > > > + par->init_sequence[i], j - i - 1,
> > >
> > > ...and get rid of the ' - i -1' part here.
> >
> > Yes, it was the first idea but I prefer this method since we save aritmethic
> > operations. In other words, if I use what you suggest, the index for
> > par->init_sequence is calculated as a "sum" every iteration. But if the
> > performance is not an issue and you believe that the above is more clear, I
> > have no problem. What do you prefer?
>
> I prefer my variant and I believe the compilers nowadays are clever
> enough to understand this.
Ok, understood. Thanks.
> Have you tried to compile and compare the real assembly?
I will test it.
> --
> With Best Regards,
> Andy Shevchenko
Regards,
Len
Powered by blists - more mailing lists