linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: hch@lst.de
Cc: linux-fsdevel@vger.kernel.org
Subject: re: locks: new locks_mandatory_area calling convention
Date: Tue, 8 Dec 2015 09:14:00 +0300	[thread overview]
Message-ID: <20151208061400.GA9116@mwanda> (raw)

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

                 reply	other threads:[~2015-12-08  6:14 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=20151208061400.GA9116@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@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).