From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp1040.oracle.com ([141.146.126.69]:27180 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932820AbbLHGOJ (ORCPT ); Tue, 8 Dec 2015 01:14:09 -0500 Date: Tue, 8 Dec 2015 09:14:00 +0300 From: Dan Carpenter To: hch@lst.de Cc: linux-fsdevel@vger.kernel.org Subject: re: locks: new locks_mandatory_area calling convention Message-ID: <20151208061400.GA9116@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hello Christoph Hellwig, This is a semi-automatic email about new static checker warnings. The patch 9e48b0c90a29: "locks: new locks_mandatory_area calling convention" from Dec 3, 2015, leads to the following Smatch complaint: fs/locks.c:1250 locks_mandatory_area() warn: variable dereferenced before check 'filp' (see line 1241) fs/locks.c 1240 { 1241 struct inode *inode = file_inode(filp); ^^^^^^^^^^^^^^^^ Patch adds new dereference inside the function call. 1242 struct file_lock fl; 1243 int error; 1244 bool sleep = false; 1245 1246 locks_init_lock(&fl); 1247 fl.fl_pid = current->tgid; 1248 fl.fl_file = filp; 1249 fl.fl_flags = FL_POSIX | FL_ACCESS; 1250 if (filp && !(filp->f_flags & O_NONBLOCK)) ^^^^ Existing check is too late. 1251 sleep = true; 1252 fl.fl_type = type; regards, dan carpenter