[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5e1e5415dc1bcda37df3ce07a18827172c2a5b7f.camel@perches.com>
Date: Wed, 10 Feb 2021 05:04:07 -0800
From: Joe Perches <joe@...ches.com>
To: Petr Mladek <pmladek@...e.com>, Yafang Shao <laoar.shao@...il.com>
Cc: Matthew Wilcox <willy@...radead.org>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
David Hildenbrand <david@...hat.com>,
Miaohe Lin <linmiaohe@...wei.com>,
Vlastimil Babka <vbabka@...e.cz>,
Christoph Lameter <cl@...ux.com>, penberg@...nel.org,
David Rientjes <rientjes@...gle.com>, iamjoonsoo.kim@....com,
Andrew Morton <akpm@...ux-foundation.org>,
Steven Rostedt <rostedt@...dmis.org>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Linux MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 3/3] vsprintf: dump full information of page flags in
pGp
On Wed, 2021-02-10 at 13:51 +0100, Petr Mladek wrote:
> On Wed 2021-02-10 00:21:37, Yafang Shao wrote:
> > On Tue, Feb 9, 2021 at 9:53 PM Petr Mladek <pmladek@...e.com> wrote:
[]
> > for (p = pff; p < pff + ARRAY_SIZE(pff); p++) {
>
> This looks a bit non-standard. IMHO, Joe was not against using index.
> He proposed:
>
> for (i = 0; i < ARRAY_SIZE(pfl) && buf < end; i++) {
>
> , see
> https://lore.kernel.org/lkml/e5ea9e8b1190c2a397a1b84dd55bb9c706dc7058.camel@perches.com/
>
> I am not sure about the (buf < end) check. It might be some
> optimization or it did fit the the old code.
I believe the buf < end bit was broken anyway.
I believe vsprintf is supposed to return the maximum possible length
of the output and the function should not restrict that. The
function should not write beyond the specified end.
> Anyway, I like the currently used:
>
> for (i = 0; i < ARRAY_SIZE(pff); i++) {
>
> It is standard, easy to understand, and thus more safe. I am sure that
> compiler will optimize it very well.
true.
Powered by blists - more mailing lists