Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [dhowells-fs:afs-fixes 2/2] fs/inode.c:2591:40: error: passing 'const struct inode *' to parameter of type 'struct inode *' discards qualifiers
@ 2025-05-19 19:21 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-05-19 19:21 UTC (permalink / raw)
  To: David Howells; +Cc: llvm, oe-kbuild-all

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git afs-fixes
head:   3d7c34e70ff9f9f109feb055469b6a056e07b88b
commit: 3d7c34e70ff9f9f109feb055469b6a056e07b88b [2/2] vfs: Fix inode ownership checks with regard to foreign ownership
config: s390-randconfig-001-20250520 (https://download.01.org/0day-ci/archive/20250520/202505200336.LdTIrBPj-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250520/202505200336.LdTIrBPj-lkp@intel.com/reproduce)

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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505200336.LdTIrBPj-lkp@intel.com/

All errors (new ones prefixed by >>):

>> fs/inode.c:2591:40: error: passing 'const struct inode *' to parameter of type 'struct inode *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
    2591 |         ret = vfs_inode_is_owned_by_me(idmap, inode);
         |                                               ^~~~~
   fs/internal.h:55:69: note: passing argument to parameter 'inode' here
      55 | int vfs_inode_is_owned_by_me(struct mnt_idmap *idmap, struct inode *inode);
         |                                                                     ^
   1 error generated.
--
>> fs/attr.c:101:40: error: passing 'const struct inode *' to parameter of type 'struct inode *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
     101 |         ret = vfs_inode_is_owned_by_me(idmap, inode);
         |                                               ^~~~~
   fs/internal.h:55:69: note: passing argument to parameter 'inode' here
      55 | int vfs_inode_is_owned_by_me(struct mnt_idmap *idmap, struct inode *inode);
         |                                                                     ^
   fs/attr.c:130:40: error: passing 'const struct inode *' to parameter of type 'struct inode *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
     130 |         ret = vfs_inode_is_owned_by_me(idmap, inode);
         |                                               ^~~~~
   fs/internal.h:55:69: note: passing argument to parameter 'inode' here
      55 | int vfs_inode_is_owned_by_me(struct mnt_idmap *idmap, struct inode *inode);
         |                                                                     ^
   2 errors generated.


vim +2591 fs/inode.c

  2569	
  2570	/**
  2571	 * inode_owner_or_capable - check current task permissions to inode
  2572	 * @idmap: idmap of the mount the inode was found from
  2573	 * @inode: inode being checked
  2574	 *
  2575	 * Return true if current either has CAP_FOWNER in a namespace with the
  2576	 * inode owner uid mapped, or owns the file.
  2577	 *
  2578	 * If the inode has been found through an idmapped mount the idmap of
  2579	 * the vfsmount must be passed through @idmap. This function will then take
  2580	 * care to map the inode according to @idmap before checking permissions.
  2581	 * On non-idmapped mounts or if permission checking is to be performed on the
  2582	 * raw inode simply pass @nop_mnt_idmap.
  2583	 */
  2584	bool inode_owner_or_capable(struct mnt_idmap *idmap,
  2585				    const struct inode *inode)
  2586	{
  2587		vfsuid_t vfsuid;
  2588		struct user_namespace *ns;
  2589		int ret;
  2590	
> 2591		ret = vfs_inode_is_owned_by_me(idmap, inode);
  2592		if (ret == 0)
  2593			return true;
  2594		if (ret < 0)
  2595			return false;
  2596	
  2597		vfsuid = i_uid_into_vfsuid(idmap, inode);
  2598		ns = current_user_ns();
  2599		if (vfsuid_has_mapping(ns, vfsuid) && ns_capable(ns, CAP_FOWNER))
  2600			return true;
  2601		return false;
  2602	}
  2603	EXPORT_SYMBOL(inode_owner_or_capable);
  2604	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-05-19 19:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-19 19:21 [dhowells-fs:afs-fixes 2/2] fs/inode.c:2591:40: error: passing 'const struct inode *' to parameter of type 'struct inode *' discards qualifiers kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox