Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: David Howells <dhowells@redhat.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [dhowells-fs:afs-fixes 2/2] fs/inode.c:2591:40: error: passing 'const struct inode *' to parameter of type 'struct inode *' discards qualifiers
Date: Tue, 20 May 2025 03:21:24 +0800	[thread overview]
Message-ID: <202505200336.LdTIrBPj-lkp@intel.com> (raw)

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

                 reply	other threads:[~2025-05-19 19:22 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=202505200336.LdTIrBPj-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dhowells@redhat.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox