lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 10 Feb 2018 17:02:01 -0800
From:   Matthew Wilcox <willy@...radead.org>
To:     Joe Perches <joe@...ches.com>
Cc:     Donglin Peng <dolinux.peng@...il.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 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.
This is not performance critical; don't try to optimise it.

  Programmers waste enormous amounts of time thinking about, or worrying
  about, the speed of noncritical parts of their programs, and these
  attempts at efficiency actually have a strong negative impact when
  debugging and maintenance are considered. We should forget about small
  efficiencies, say about 97% of the time: premature optimization is the
  root of all evil. Yet we should not pass up our opportunities in that
  critical 3%.  -- Donald Knuth

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ