All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: NeilBrown <neil@brown.name>
Cc: oe-kbuild-all@lists.linux.dev, Christian Brauner <brauner@kernel.org>
Subject: [linux-next:master 1231/1936] fs/kernfs/mount.c:258:57: sparse: sparse: incorrect type in argument 1 (different address spaces)
Date: Wed, 9 Apr 2025 03:26:12 +0800	[thread overview]
Message-ID: <202504090310.xjNpww93-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   7702d0130dc002bab2c3571ddb6ff68f82d99aea
commit: 973256a7be6ed574f242995c15a8aa80cc0cc566 [1231/1936] VFS: rename lookup_one_len family to lookup_noperm and remove permission check
config: x86_64-randconfig-122-20250408 (https://download.01.org/0day-ci/archive/20250409/202504090310.xjNpww93-lkp@intel.com/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250409/202504090310.xjNpww93-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/202504090310.xjNpww93-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   fs/kernfs/mount.c:258:57: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected char const * @@     got char const [noderef] __rcu *name @@
   fs/kernfs/mount.c:258:57: sparse:     expected char const *
   fs/kernfs/mount.c:258:57: sparse:     got char const [noderef] __rcu *name
   fs/kernfs/mount.c:258:57: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected char const * @@     got char const [noderef] __rcu *name @@
   fs/kernfs/mount.c:258:57: sparse:     expected char const *
   fs/kernfs/mount.c:258:57: sparse:     got char const [noderef] __rcu *name
>> fs/kernfs/mount.c:258:57: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected char const *const p @@     got char const [noderef] __rcu *name @@
   fs/kernfs/mount.c:258:57: sparse:     expected char const *const p
   fs/kernfs/mount.c:258:57: sparse:     got char const [noderef] __rcu *name
   fs/kernfs/mount.c:258:57: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected unsigned char const *name @@     got char const [noderef] __rcu *name @@
   fs/kernfs/mount.c:258:57: sparse:     expected unsigned char const *name
   fs/kernfs/mount.c:258:57: sparse:     got char const [noderef] __rcu *name

vim +258 fs/kernfs/mount.c

   199	
   200	/**
   201	 * kernfs_node_dentry - get a dentry for the given kernfs_node
   202	 * @kn: kernfs_node for which a dentry is needed
   203	 * @sb: the kernfs super_block
   204	 *
   205	 * Return: the dentry pointer
   206	 */
   207	struct dentry *kernfs_node_dentry(struct kernfs_node *kn,
   208					  struct super_block *sb)
   209	{
   210		struct dentry *dentry;
   211		struct kernfs_node *knparent;
   212		struct kernfs_root *root;
   213	
   214		BUG_ON(sb->s_op != &kernfs_sops);
   215	
   216		dentry = dget(sb->s_root);
   217	
   218		/* Check if this is the root kernfs_node */
   219		if (!rcu_access_pointer(kn->__parent))
   220			return dentry;
   221	
   222		root = kernfs_root(kn);
   223		/*
   224		 * As long as kn is valid, its parent can not vanish. This is cgroup's
   225		 * kn so it can't have its parent replaced. Therefore it is safe to use
   226		 * the ancestor node outside of the RCU or locked section.
   227		 */
   228		if (WARN_ON_ONCE(!(root->flags & KERNFS_ROOT_INVARIANT_PARENT)))
   229			return ERR_PTR(-EINVAL);
   230		scoped_guard(rcu) {
   231			knparent = find_next_ancestor(kn, NULL);
   232		}
   233		if (WARN_ON(!knparent)) {
   234			dput(dentry);
   235			return ERR_PTR(-EINVAL);
   236		}
   237	
   238		do {
   239			struct dentry *dtmp;
   240			struct kernfs_node *kntmp;
   241			const char *name;
   242	
   243			if (kn == knparent)
   244				return dentry;
   245	
   246			scoped_guard(rwsem_read, &root->kernfs_rwsem) {
   247				kntmp = find_next_ancestor(kn, knparent);
   248				if (WARN_ON(!kntmp)) {
   249					dput(dentry);
   250					return ERR_PTR(-EINVAL);
   251				}
   252				name = kstrdup(kernfs_rcu_name(kntmp), GFP_KERNEL);
   253			}
   254			if (!name) {
   255				dput(dentry);
   256				return ERR_PTR(-ENOMEM);
   257			}
 > 258			dtmp = lookup_noperm_positive_unlocked(&QSTR(kntmp->name), dentry);
   259			dput(dentry);
   260			kfree(name);
   261			if (IS_ERR(dtmp))
   262				return dtmp;
   263			knparent = kntmp;
   264			dentry = dtmp;
   265		} while (true);
   266	}
   267	

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

             reply	other threads:[~2025-04-08 19:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-08 19:26 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-04-08  9:15 [linux-next:master 1231/1936] fs/kernfs/mount.c:258:57: sparse: sparse: incorrect type in argument 1 (different address spaces) kernel test robot
2025-04-08  9:24 ` Christian Brauner

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=202504090310.xjNpww93-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=brauner@kernel.org \
    --cc=neil@brown.name \
    --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 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.