Linux-Fsdevel Archive on lore.kernel.org
 help / color / Atom feed
* [bug report] fsnotify: pass dir and inode arguments to fsnotify()
@ 2020-07-30 11:13 dan.carpenter
  2020-07-30 11:55 ` Amir Goldstein
  0 siblings, 1 reply; 3+ messages in thread
From: dan.carpenter @ 2020-07-30 11:13 UTC (permalink / raw)
  To: amir73il; +Cc: linux-fsdevel

Hello Amir Goldstein,

This is a semi-automatic email about new static checker warnings.

The patch 40a100d3adc1: "fsnotify: pass dir and inode arguments to
fsnotify()" from Jul 22, 2020, leads to the following Smatch
complaint:

    fs/notify/fsnotify.c:460 fsnotify()
    warn: variable dereferenced before check 'inode' (see line 449)

fs/notify/fsnotify.c
   448		}
   449		sb = inode->i_sb;
                     ^^^^^^^^^^^
New dreference.

   450	
   451		/*
   452		 * Optimization: srcu_read_lock() has a memory barrier which can
   453		 * be expensive.  It protects walking the *_fsnotify_marks lists.
   454		 * However, if we do not walk the lists, we do not have to do
   455		 * SRCU because we have no references to any objects and do not
   456		 * need SRCU to keep them "alive".
   457		 */
   458		if (!sb->s_fsnotify_marks &&
   459		    (!mnt || !mnt->mnt_fsnotify_marks) &&
   460		    (!inode || !inode->i_fsnotify_marks) &&
                     ^^^^^^
Check too late.  Presumably this check can be removed?

   461		    (!child || !child->i_fsnotify_marks))
   462			return 0;

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30 11:13 [bug report] fsnotify: pass dir and inode arguments to fsnotify() dan.carpenter
2020-07-30 11:55 ` Amir Goldstein
2020-07-30 19:25   ` Jan Kara

Linux-Fsdevel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-fsdevel/0 linux-fsdevel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-fsdevel linux-fsdevel/ https://lore.kernel.org/linux-fsdevel \
		linux-fsdevel@vger.kernel.org
	public-inbox-index linux-fsdevel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-fsdevel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git