All of lore.kernel.org
 help / color / mirror / Atom feed
From: Donglin Peng <dolinux.peng@gmail.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Joe Perches <joe@perches.com>,
	viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] seq_file: remove redundant assignment of index to m->index
Date: Sun, 11 Feb 2018 13:46:22 +0800	[thread overview]
Message-ID: <CAErzpmtU+HOasX1PEpFyV6-aJgjn4KsH8mOa6ekySCEXCc_1ug@mail.gmail.com> (raw)
In-Reply-To: <20180211010201.GA14719@bombadil.infradead.org>

On Sun, Feb 11, 2018 at 9:02 AM, Matthew Wilcox <willy@infradead.org> wrote:
> On Sat, Feb 10, 2018 at 10:04:23AM -0800, Joe Perches wrote:
>> > @@ -120,14 +120,12 @@ static int traverse(struct seq_file *m, loff_t offset)
>> >          if (pos + m->count > offset) {
>> >              m->from = offset - pos;
>> >              m->count -= m->from;
>> > -            m->index = index;
>> >              break;
>> >          }
>> >          pos += m->count;
>> >          m->count = 0;
>> >          if (pos == offset) {
>> >              index++;
>> > -            m->index = index;
>> >              break;
>> >          }
>> >          p = m->op->next(m, p, &index);
>>
>> Of course this looks correct, but how
>> are you _absolutely sure_ about this?
>>
>> Perhaps the m->op->stop(m, p) call below
>> the break, which takes m as an argument,
>> needs an updated m->index.
>
> Not only that, but ->next might also look at m->index.
I think there is no chance to call op->next, because the loop will
break immediately
after the assignment.

      reply	other threads:[~2018-02-11  5:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-10 15:59 [PATCH] seq_file: remove redundant assignment of index to m->index Donglin Peng
2018-02-10 18:04 ` Joe Perches
2018-02-11  1:02   ` Matthew Wilcox
2018-02-11  5:46     ` Donglin Peng [this message]

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=CAErzpmtU+HOasX1PEpFyV6-aJgjn4KsH8mOa6ekySCEXCc_1ug@mail.gmail.com \
    --to=dolinux.peng@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.