linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] epoll: extra check in ep_item_poll()
@ 2020-06-07  7:10 Vasily Averin
  0 siblings, 0 replies; only message in thread
From: Vasily Averin @ 2020-06-07  7:10 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Alexander Viro

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-06-07  7:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-07  7:10 [PATCH] epoll: extra check in ep_item_poll() Vasily Averin

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).