linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vasily Averin <vvs@virtuozzo.com>
To: linux-fsdevel@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH] epoll: extra check in ep_item_poll()
Date: Sun, 7 Jun 2020 10:10:26 +0300	[thread overview]
Message-ID: <f56c28cb-565c-6cc0-8ed6-34492cacc300@virtuozzo.com> (raw)

reported by smatch:
fs/eventpoll.c:891 ep_item_poll() warn:
 variable dereferenced before check 'pt' (see line 885)

ep_item_poll() is newer called with empty 'pt' argument,
and it is dereferenced in the beginning of this function,
so 'pt' check in line 891 looks useless

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 fs/eventpoll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 12eebcd..5ddb549 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -888,7 +888,7 @@ static __poll_t ep_item_poll(const struct epitem *epi, poll_table *pt,
 
 	ep = epi->ffd.file->private_data;
 	poll_wait(epi->ffd.file, &ep->poll_wait, pt);
-	locked = pt && (pt->_qproc == ep_ptable_queue_proc);
+	locked = (pt->_qproc == ep_ptable_queue_proc);
 
 	return ep_scan_ready_list(epi->ffd.file->private_data,
 				  ep_read_events_proc, &depth, depth,
-- 
1.8.3.1


                 reply	other threads:[~2020-06-07  7:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=f56c28cb-565c-6cc0-8ed6-34492cacc300@virtuozzo.com \
    --to=vvs@virtuozzo.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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).