Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753170AbdLUPyf (ORCPT ); Thu, 21 Dec 2017 10:54:35 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:33267 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751808AbdLUPyb (ORCPT ); Thu, 21 Dec 2017 10:54:31 -0500 X-Google-Smtp-Source: ACJfBouWqsKgXoQuoC20tAvj1ygeJMKJ6/t4y1JC+RZfA/OvFa/vXT+RE+B9eZn94RY+P2kbwnHCgA== From: Vasyl Gomonovych To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, gomonovych@gmail.com Cc: linux-kernel@vger.kernel.org Subject: [PATCH] epoll: fix dereferenced before check pt Date: Thu, 21 Dec 2017 16:54:17 +0100 Message-Id: <1513871657-11239-1-git-send-email-gomonovych@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 739 Lines: 25 This patch fixes the warning reported by smatch: fs/eventpoll.c:889 ep_item_poll() warn: variable dereferenced before check 'pt' Signed-off-by: Vasyl Gomonovych --- fs/eventpoll.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index afd548ebc328..fc772a1f1396 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -879,7 +879,8 @@ static unsigned int ep_item_poll(struct epitem *epi, poll_table *pt, int depth) struct eventpoll *ep; bool locked; - pt->_key = epi->event.events; + if (pt) + pt->_key = epi->event.events; if (!is_file_epoll(epi->ffd.file)) return epi->ffd.file->f_op->poll(epi->ffd.file, pt) & epi->event.events; -- 1.9.1