linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Petr Mladek <pmladek@suse.com>, Yafang Shao <laoar.shao@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	David Hildenbrand <david@redhat.com>,
	 Miaohe Lin <linmiaohe@huawei.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Christoph Lameter <cl@linux.com>,
	 penberg@kernel.org, David Rientjes <rientjes@google.com>,
	iamjoonsoo.kim@lge.com,
	 Andrew Morton <akpm@linux-foundation.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Linux MM <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 3/3] vsprintf: dump full information of page flags in pGp
Date: Wed, 10 Feb 2021 05:04:07 -0800	[thread overview]
Message-ID: <5e1e5415dc1bcda37df3ce07a18827172c2a5b7f.camel@perches.com> (raw)
In-Reply-To: <YCPWypWctDMGWUpA@alley>

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@suse.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.




  reply	other threads:[~2021-02-10 13:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-09 10:56 [PATCH v4 0/3] mm, vsprintf: dump full information of page flags in pGp Yafang Shao
2021-02-09 10:56 ` [PATCH v4 1/3] mm, slub: use pGp to print page flags Yafang Shao
2021-02-09 10:57   ` David Hildenbrand
2021-02-09 10:56 ` [PATCH v4 2/3] mm, slub: don't combine pr_err with INFO Yafang Shao
2021-02-09 10:57   ` David Hildenbrand
2021-02-09 10:56 ` [PATCH v4 3/3] vsprintf: dump full information of page flags in pGp Yafang Shao
2021-02-09 11:00   ` David Hildenbrand
2021-02-09 12:00   ` Vlastimil Babka
2021-02-09 13:53   ` Petr Mladek
2021-02-09 14:16     ` Andy Shevchenko
2021-02-09 14:57       ` Petr Mladek
2021-02-09 16:21     ` Yafang Shao
2021-02-10 12:51       ` Petr Mladek
2021-02-10 13:04         ` Joe Perches [this message]
2021-02-10 15:39         ` Yafang Shao
2021-02-09 12:41 ` [PATCH v4 0/3] mm, " Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5e1e5415dc1bcda37df3ce07a18827172c2a5b7f.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=cl@linux.com \
    --cc=david@redhat.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=laoar.shao@gmail.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=pmladek@suse.com \
    --cc=rientjes@google.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).