[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAErzpmtU+HOasX1PEpFyV6-aJgjn4KsH8mOa6ekySCEXCc_1ug@mail.gmail.com>
Date: Sun, 11 Feb 2018 13:46:22 +0800
From: Donglin Peng <dolinux.peng@...il.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: Joe Perches <joe@...ches.com>, viro@...iv.linux.org.uk,
linux-fsdevel@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] seq_file: remove redundant assignment of index to m->index
On Sun, Feb 11, 2018 at 9:02 AM, Matthew Wilcox <willy@...radead.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.
Powered by blists - more mailing lists