All of lore.kernel.org
 help / color / mirror / Atom feed
* [android-common:android-mainline 1/1] fs/incfs/pseudo_files.c:885:25: sparse: sparse: incorrect type in argument 4 (different base types)
@ 2020-09-23  8:31 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-09-23  8:31 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 6807 bytes --]

tree:   https://android.googlesource.com/kernel/common android-mainline
head:   8334d69e65f6064aede4fb56fe15ae30630d5337
commit: 8334d69e65f6064aede4fb56fe15ae30630d5337 [1/1] ANDROID: Incremental fs: Separate pseudo-file code
config: i386-randconfig-s002-20200923 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.2-201-g24bdaac6-dirty
        git checkout 8334d69e65f6064aede4fb56fe15ae30630d5337
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)

>> fs/incfs/pseudo_files.c:885:25: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected unsigned long long [usertype] size @@     got restricted __le64 [addressable] [assigned] [usertype] size_attr_value @@
>> fs/incfs/pseudo_files.c:885:25: sparse:     expected unsigned long long [usertype] size
>> fs/incfs/pseudo_files.c:885:25: sparse:     got restricted __le64 [addressable] [assigned] [usertype] size_attr_value
>> fs/incfs/pseudo_files.c:885:42: sparse: sparse: incorrect type in argument 5 (different base types) @@     expected unsigned long long [usertype] offset @@     got restricted __le64 [usertype] @@
>> fs/incfs/pseudo_files.c:885:42: sparse:     expected unsigned long long [usertype] offset
>> fs/incfs/pseudo_files.c:885:42: sparse:     got restricted __le64 [usertype]
>> fs/incfs/pseudo_files.c:682:48: sparse: sparse: non size-preserving integer to pointer cast

git remote add android-common https://android.googlesource.com/kernel/common
git fetch --no-tags android-common android-mainline
git checkout 8334d69e65f6064aede4fb56fe15ae30630d5337
vim +885 fs/incfs/pseudo_files.c

   758	
   759	static long ioctl_create_mapped_file(struct mount_info *mi, void __user *arg)
   760	{
   761		struct incfs_create_mapped_file_args __user *args_usr_ptr = arg;
   762		struct incfs_create_mapped_file_args args = {};
   763		char *file_name;
   764		int error = 0;
   765		struct path parent_dir_path = {};
   766		char *source_file_name = NULL;
   767		struct dentry *source_file_dentry = NULL;
   768		u64 source_file_size;
   769		struct dentry *file_dentry = NULL;
   770		struct inode *parent_inode;
   771		__le64 size_attr_value;
   772	
   773		if (copy_from_user(&args, args_usr_ptr, sizeof(args)) > 0)
   774			return -EINVAL;
   775	
   776		file_name = strndup_user(u64_to_user_ptr(args.file_name), PATH_MAX);
   777		if (IS_ERR(file_name)) {
   778			error = PTR_ERR(file_name);
   779			file_name = NULL;
   780			goto out;
   781		}
   782	
   783		error = validate_name(file_name);
   784		if (error)
   785			goto out;
   786	
   787		if (args.source_offset % INCFS_DATA_FILE_BLOCK_SIZE) {
   788			error = -EINVAL;
   789			goto out;
   790		}
   791	
   792		/* Validate file mapping is in range */
   793		source_file_name = file_id_to_str(args.source_file_id);
   794		if (!source_file_name) {
   795			pr_warn("Failed to alloc source_file_name\n");
   796			error = -ENOMEM;
   797			goto out;
   798		}
   799	
   800		source_file_dentry = incfs_lookup_dentry(mi->mi_index_dir,
   801							       source_file_name);
   802		if (!source_file_dentry) {
   803			pr_warn("Source file does not exist\n");
   804			error = -EINVAL;
   805			goto out;
   806		}
   807		if (IS_ERR(source_file_dentry)) {
   808			pr_warn("Error opening source file\n");
   809			error = PTR_ERR(source_file_dentry);
   810			source_file_dentry = NULL;
   811			goto out;
   812		}
   813		if (!d_really_is_positive(source_file_dentry)) {
   814			pr_warn("Source file dentry negative\n");
   815			error = -EINVAL;
   816			goto out;
   817		}
   818	
   819		error = vfs_getxattr(source_file_dentry, INCFS_XATTR_SIZE_NAME,
   820				     (char *)&size_attr_value, sizeof(size_attr_value));
   821		if (error < 0)
   822			goto out;
   823	
   824		if (error != sizeof(size_attr_value)) {
   825			pr_warn("Mapped file has no size attr\n");
   826			error = -EINVAL;
   827			goto out;
   828		}
   829	
   830		source_file_size = le64_to_cpu(size_attr_value);
   831		if (args.source_offset + args.size > source_file_size) {
   832			pr_warn("Mapped file out of range\n");
   833			error = -EINVAL;
   834			goto out;
   835		}
   836	
   837		/* Find a directory to put the file into. */
   838		error = dir_relative_path_resolve(mi,
   839				u64_to_user_ptr(args.directory_path),
   840				&parent_dir_path);
   841		if (error)
   842			goto out;
   843	
   844		if (parent_dir_path.dentry == mi->mi_index_dir) {
   845			/* Can't create a file directly inside .index */
   846			error = -EBUSY;
   847			goto out;
   848		}
   849	
   850		/* Look up a dentry in the parent dir. It should be negative. */
   851		file_dentry = incfs_lookup_dentry(parent_dir_path.dentry,
   852						file_name);
   853		if (!file_dentry) {
   854			error = -EFAULT;
   855			goto out;
   856		}
   857		if (IS_ERR(file_dentry)) {
   858			error = PTR_ERR(file_dentry);
   859			file_dentry = NULL;
   860			goto out;
   861		}
   862		if (d_really_is_positive(file_dentry)) {
   863			error = -EEXIST;
   864			goto out;
   865		}
   866	
   867		parent_inode = d_inode(parent_dir_path.dentry);
   868		inode_lock_nested(parent_inode, I_MUTEX_PARENT);
   869		error = vfs_create(parent_inode, file_dentry, args.mode | 0222, true);
   870		inode_unlock(parent_inode);
   871		if (error)
   872			goto out;
   873	
   874		/* Save the file's size as an xattr for easy fetching in future. */
   875		size_attr_value = cpu_to_le64(args.size);
   876		error = vfs_setxattr(file_dentry, INCFS_XATTR_SIZE_NAME,
   877			(char *)&size_attr_value, sizeof(size_attr_value),
   878			XATTR_CREATE);
   879		if (error) {
   880			pr_debug("incfs: vfs_setxattr err:%d\n", error);
   881			goto delete_file;
   882		}
   883	
   884		error = init_new_mapped_file(mi, file_dentry, &args.source_file_id,
 > 885				size_attr_value, cpu_to_le64(args.source_offset));
   886		if (error)
   887			goto delete_file;
   888	
   889		goto out;
   890	
   891	delete_file:
   892		incfs_unlink(file_dentry);
   893	
   894	out:
   895		dput(file_dentry);
   896		dput(source_file_dentry);
   897		path_put(&parent_dir_path);
   898		kfree(file_name);
   899		kfree(source_file_name);
   900		return error;
   901	}
   902	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31720 bytes --]

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

only message in thread, other threads:[~2020-09-23  8:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23  8:31 [android-common:android-mainline 1/1] fs/incfs/pseudo_files.c:885:25: sparse: sparse: incorrect type in argument 4 (different base types) kernel test robot

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.