oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Mike Tipton <quic_mdtipton@quicinc.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Georgi Djakov <djakov@kernel.org>
Subject: fs/debugfs/file.c:942:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
Date: Sat, 9 Sep 2023 19:23:15 +0800	[thread overview]
Message-ID: <202309091933.BRWlSnCq-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   6099776f9f268e61fe5ecd721f994a8cfce5306f
commit: 86b5488121db563b33684f56aafa62156f764be3 debugfs: Add write support to debugfs_create_str()
date:   3 weeks ago
config: i386-randconfig-061-20230909 (https://download.01.org/0day-ci/archive/20230909/202309091933.BRWlSnCq-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230909/202309091933.BRWlSnCq-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/202309091933.BRWlSnCq-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> fs/debugfs/file.c:942:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
>> fs/debugfs/file.c:942:9: sparse:    char [noderef] __rcu *
>> fs/debugfs/file.c:942:9: sparse:    char *

vim +942 fs/debugfs/file.c

   903	
   904	static ssize_t debugfs_write_file_str(struct file *file, const char __user *user_buf,
   905					      size_t count, loff_t *ppos)
   906	{
   907		struct dentry *dentry = F_DENTRY(file);
   908		char *old, *new = NULL;
   909		int pos = *ppos;
   910		int r;
   911	
   912		r = debugfs_file_get(dentry);
   913		if (unlikely(r))
   914			return r;
   915	
   916		old = *(char **)file->private_data;
   917	
   918		/* only allow strict concatenation */
   919		r = -EINVAL;
   920		if (pos && pos != strlen(old))
   921			goto error;
   922	
   923		r = -E2BIG;
   924		if (pos + count + 1 > PAGE_SIZE)
   925			goto error;
   926	
   927		r = -ENOMEM;
   928		new = kmalloc(pos + count + 1, GFP_KERNEL);
   929		if (!new)
   930			goto error;
   931	
   932		if (pos)
   933			memcpy(new, old, pos);
   934	
   935		r = -EFAULT;
   936		if (copy_from_user(new + pos, user_buf, count))
   937			goto error;
   938	
   939		new[pos + count] = '\0';
   940		strim(new);
   941	
 > 942		rcu_assign_pointer(*(char **)file->private_data, new);
   943		synchronize_rcu();
   944		kfree(old);
   945	
   946		debugfs_file_put(dentry);
   947		return count;
   948	
   949	error:
   950		kfree(new);
   951		debugfs_file_put(dentry);
   952		return r;
   953	}
   954	

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

                 reply	other threads:[~2023-09-09 11:24 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=202309091933.BRWlSnCq-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=djakov@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=quic_mdtipton@quicinc.com \
    /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;
as well as URLs for NNTP newsgroup(s).