linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Vasyl Gomonovych <gomonovych@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] epoll: fix dereferenced before check pt
Date: Fri, 22 Dec 2017 00:02:07 +0000	[thread overview]
Message-ID: <20171222000207.GY21978@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1513871657-11239-1-git-send-email-gomonovych@gmail.com>

On Thu, Dec 21, 2017 at 04:54:17PM +0100, Vasyl Gomonovych wrote:
> This patch fixes the warning reported by smatch:
> 
> fs/eventpoll.c:889 ep_item_poll() warn: variable dereferenced before check 'pt'

... and of course, that is all the analysis one might want - the tool has
spoken.  Except that the only thing proven is that the tool is either misused
or just plain crappy.

Callers of ep_item_poll() are easily found - it's static, so they all are in
the same file.  All four of them -
                if (ep_item_poll(epi, &pt, depth)) {
        revents = ep_item_poll(epi, &epq.pt, 1);
        if (ep_item_poll(epi, &pt, 1)) {
                revents = ep_item_poll(epi, &pt, 1);

Figuring out why an address of a local variable or of a field thereof can never
be NULL is left as an exercise for an introductory course on C.

"Fixing warnings" is bloody wrong - warning (from any tool) is a heuristic
pointing to a place that might be worth looking into.  In cases when you've
found a real problem with help from some tool, sure, go ahead and credit that
tool in the commit message.  Along with the description of the problem
you've found.

      reply	other threads:[~2017-12-22  0:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21 15:54 [PATCH] epoll: fix dereferenced before check pt Vasyl Gomonovych
2017-12-22  0:02 ` Al Viro [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=20171222000207.GY21978@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=gomonovych@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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).