All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Julia Lawall <julia.lawall@inria.fr>
Subject: fs/notify/fanotify/fanotify_user.c:1233:20-23: ERROR: invalid reference to the index variable of the iterator on line 1219
Date: Sat, 20 Jan 2024 04:16:44 +0800	[thread overview]
Message-ID: <202401200402.hYIvCgSX-lkp@intel.com> (raw)

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Amir Goldstein <amir73il@gmail.com>
CC: Jan Kara <jack@suse.cz>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   556e2d17cae620d549c5474b1ece053430cd50bc
commit: 30ad1938326bf9303ca38090339d948975a626f5 fanotify: allow "weak" fsid when watching a single filesystem
date:   7 weeks ago
:::::: branch date: 2 hours ago
:::::: commit date: 7 weeks ago
config: hexagon-randconfig-r061-20240117 (https://download.01.org/0day-ci/archive/20240120/202401200402.hYIvCgSX-lkp@intel.com/config)
compiler: clang version 18.0.0git (https://github.com/llvm/llvm-project 9bde5becb44ea071f5e1fa1f5d4071dc8788b18c)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Julia Lawall <julia.lawall@inria.fr>
| Closes: https://lore.kernel.org/r/202401200402.hYIvCgSX-lkp@intel.com/

cocci warnings: (new ones prefixed by >>)
>> fs/notify/fanotify/fanotify_user.c:1233:20-23: ERROR: invalid reference to the index variable of the iterator on line 1219

vim +1233 fs/notify/fanotify/fanotify_user.c

30ad1938326bf93 Amir Goldstein 2023-11-30  1200  
30ad1938326bf93 Amir Goldstein 2023-11-30  1201  static int fanotify_set_mark_fsid(struct fsnotify_group *group,
30ad1938326bf93 Amir Goldstein 2023-11-30  1202  				  struct fsnotify_mark *mark,
30ad1938326bf93 Amir Goldstein 2023-11-30  1203  				  struct fan_fsid *fsid)
30ad1938326bf93 Amir Goldstein 2023-11-30  1204  {
30ad1938326bf93 Amir Goldstein 2023-11-30  1205  	struct fsnotify_mark_connector *conn;
30ad1938326bf93 Amir Goldstein 2023-11-30  1206  	struct fsnotify_mark *old;
30ad1938326bf93 Amir Goldstein 2023-11-30  1207  	struct super_block *old_sb = NULL;
30ad1938326bf93 Amir Goldstein 2023-11-30  1208  
30ad1938326bf93 Amir Goldstein 2023-11-30  1209  	FANOTIFY_MARK(mark)->fsid = fsid->id;
30ad1938326bf93 Amir Goldstein 2023-11-30  1210  	mark->flags |= FSNOTIFY_MARK_FLAG_HAS_FSID;
30ad1938326bf93 Amir Goldstein 2023-11-30  1211  	if (fsid->weak)
30ad1938326bf93 Amir Goldstein 2023-11-30  1212  		mark->flags |= FSNOTIFY_MARK_FLAG_WEAK_FSID;
30ad1938326bf93 Amir Goldstein 2023-11-30  1213  
30ad1938326bf93 Amir Goldstein 2023-11-30  1214  	/* First mark added will determine if group is single or multi fsid */
30ad1938326bf93 Amir Goldstein 2023-11-30  1215  	if (list_empty(&group->marks_list))
30ad1938326bf93 Amir Goldstein 2023-11-30  1216  		return 0;
30ad1938326bf93 Amir Goldstein 2023-11-30  1217  
30ad1938326bf93 Amir Goldstein 2023-11-30  1218  	/* Find sb of an existing mark */
30ad1938326bf93 Amir Goldstein 2023-11-30 @1219  	list_for_each_entry(old, &group->marks_list, g_list) {
30ad1938326bf93 Amir Goldstein 2023-11-30  1220  		conn = READ_ONCE(old->connector);
30ad1938326bf93 Amir Goldstein 2023-11-30  1221  		if (!conn)
30ad1938326bf93 Amir Goldstein 2023-11-30  1222  			continue;
30ad1938326bf93 Amir Goldstein 2023-11-30  1223  		old_sb = fsnotify_connector_sb(conn);
30ad1938326bf93 Amir Goldstein 2023-11-30  1224  		if (old_sb)
30ad1938326bf93 Amir Goldstein 2023-11-30  1225  			break;
30ad1938326bf93 Amir Goldstein 2023-11-30  1226  	}
30ad1938326bf93 Amir Goldstein 2023-11-30  1227  
30ad1938326bf93 Amir Goldstein 2023-11-30  1228  	/* Only detached marks left? */
30ad1938326bf93 Amir Goldstein 2023-11-30  1229  	if (!old_sb)
30ad1938326bf93 Amir Goldstein 2023-11-30  1230  		return 0;
30ad1938326bf93 Amir Goldstein 2023-11-30  1231  
30ad1938326bf93 Amir Goldstein 2023-11-30  1232  	/* Do not allow mixing of marks with weak and strong fsid */
30ad1938326bf93 Amir Goldstein 2023-11-30 @1233  	if ((mark->flags ^ old->flags) & FSNOTIFY_MARK_FLAG_WEAK_FSID)
30ad1938326bf93 Amir Goldstein 2023-11-30  1234  		return -EXDEV;
30ad1938326bf93 Amir Goldstein 2023-11-30  1235  
30ad1938326bf93 Amir Goldstein 2023-11-30  1236  	/* Allow mixing of marks with strong fsid from different fs */
30ad1938326bf93 Amir Goldstein 2023-11-30  1237  	if (!fsid->weak)
30ad1938326bf93 Amir Goldstein 2023-11-30  1238  		return 0;
30ad1938326bf93 Amir Goldstein 2023-11-30  1239  
30ad1938326bf93 Amir Goldstein 2023-11-30  1240  	/* Do not allow mixing marks with weak fsid from different fs */
30ad1938326bf93 Amir Goldstein 2023-11-30  1241  	if (old_sb != fsid->sb)
30ad1938326bf93 Amir Goldstein 2023-11-30  1242  		return -EXDEV;
30ad1938326bf93 Amir Goldstein 2023-11-30  1243  
30ad1938326bf93 Amir Goldstein 2023-11-30  1244  	/* Do not allow mixing marks from different btrfs sub-volumes */
30ad1938326bf93 Amir Goldstein 2023-11-30  1245  	if (!fanotify_fsid_equal(&FANOTIFY_MARK(old)->fsid,
30ad1938326bf93 Amir Goldstein 2023-11-30  1246  				 &FANOTIFY_MARK(mark)->fsid))
30ad1938326bf93 Amir Goldstein 2023-11-30  1247  		return -EXDEV;
30ad1938326bf93 Amir Goldstein 2023-11-30  1248  
30ad1938326bf93 Amir Goldstein 2023-11-30  1249  	return 0;
30ad1938326bf93 Amir Goldstein 2023-11-30  1250  }
30ad1938326bf93 Amir Goldstein 2023-11-30  1251  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

             reply	other threads:[~2024-01-19 20:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 20:16 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-09-30 19:24 fs/notify/fanotify/fanotify_user.c:1233:20-23: ERROR: invalid reference to the index variable of the iterator on line 1219 kernel test robot
2024-11-18 15:08 kernel test robot
2024-12-02  3:14 kernel test robot
2024-12-09 18:33 kernel test robot

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=202401200402.hYIvCgSX-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=julia.lawall@inria.fr \
    --cc=oe-kbuild@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.