oe-kbuild-all.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [android-common:android12-trusty-5.10 1415/7892] fs/incfs/pseudo_files.c:682:31: warning: cast to pointer from integer of different size
@ 2023-02-14 22:12 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-02-14 22:12 UTC (permalink / raw)
  To: cros-kernel-buildreports; +Cc: oe-kbuild-all

Hi Paul,

FYI, the error/warning still remains.

tree:   https://android.googlesource.com/kernel/common android12-trusty-5.10
head:   e88b0fcae6db893ef5f2a45ad70499e02ee01a4e
commit: 8334d69e65f6064aede4fb56fe15ae30630d5337 [1415/7892] ANDROID: Incremental fs: Separate pseudo-file code
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20230215/202302150629.EvqJ4XOw-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
        git remote add android-common https://android.googlesource.com/kernel/common
        git fetch --no-tags android-common android12-trusty-5.10
        git checkout 8334d69e65f6064aede4fb56fe15ae30630d5337
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 O=build_dir ARCH=i386 olddefconfig
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash fs/incfs/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202302150629.EvqJ4XOw-lkp@intel.com/

All warnings (new ones prefixed by >>):

   fs/incfs/pseudo_files.c: In function 'ioctl_create_file':
>> fs/incfs/pseudo_files.c:682:31: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     682 |                               (u8 __user *)args.signature_info,
         |                               ^


vim +682 fs/incfs/pseudo_files.c

   517	
   518	static long ioctl_create_file(struct mount_info *mi,
   519				struct incfs_new_file_args __user *usr_args)
   520	{
   521		struct incfs_new_file_args args;
   522		char *file_id_str = NULL;
   523		struct dentry *index_file_dentry = NULL;
   524		struct dentry *named_file_dentry = NULL;
   525		struct path parent_dir_path = {};
   526		struct inode *index_dir_inode = NULL;
   527		__le64 size_attr_value = 0;
   528		char *file_name = NULL;
   529		char *attr_value = NULL;
   530		int error = 0;
   531		bool locked = false;
   532	
   533		if (!mi || !mi->mi_index_dir) {
   534			error = -EFAULT;
   535			goto out;
   536		}
   537	
   538		if (copy_from_user(&args, usr_args, sizeof(args)) > 0) {
   539			error = -EFAULT;
   540			goto out;
   541		}
   542	
   543		file_name = strndup_user(u64_to_user_ptr(args.file_name), PATH_MAX);
   544		if (IS_ERR(file_name)) {
   545			error = PTR_ERR(file_name);
   546			file_name = NULL;
   547			goto out;
   548		}
   549	
   550		error = validate_name(file_name);
   551		if (error)
   552			goto out;
   553	
   554		file_id_str = file_id_to_str(args.file_id);
   555		if (!file_id_str) {
   556			error = -ENOMEM;
   557			goto out;
   558		}
   559	
   560		error = mutex_lock_interruptible(&mi->mi_dir_struct_mutex);
   561		if (error)
   562			goto out;
   563		locked = true;
   564	
   565		/* Find a directory to put the file into. */
   566		error = dir_relative_path_resolve(mi,
   567				u64_to_user_ptr(args.directory_path),
   568				&parent_dir_path);
   569		if (error)
   570			goto out;
   571	
   572		if (parent_dir_path.dentry == mi->mi_index_dir) {
   573			/* Can't create a file directly inside .index */
   574			error = -EBUSY;
   575			goto out;
   576		}
   577	
   578		/* Look up a dentry in the parent dir. It should be negative. */
   579		named_file_dentry = incfs_lookup_dentry(parent_dir_path.dentry,
   580						file_name);
   581		if (!named_file_dentry) {
   582			error = -EFAULT;
   583			goto out;
   584		}
   585		if (IS_ERR(named_file_dentry)) {
   586			error = PTR_ERR(named_file_dentry);
   587			named_file_dentry = NULL;
   588			goto out;
   589		}
   590		if (d_really_is_positive(named_file_dentry)) {
   591			/* File with this path already exists. */
   592			error = -EEXIST;
   593			goto out;
   594		}
   595		/* Look up a dentry in the .index dir. It should be negative. */
   596		index_file_dentry = incfs_lookup_dentry(mi->mi_index_dir, file_id_str);
   597		if (!index_file_dentry) {
   598			error = -EFAULT;
   599			goto out;
   600		}
   601		if (IS_ERR(index_file_dentry)) {
   602			error = PTR_ERR(index_file_dentry);
   603			index_file_dentry = NULL;
   604			goto out;
   605		}
   606		if (d_really_is_positive(index_file_dentry)) {
   607			/* File with this ID already exists in index. */
   608			error = -EEXIST;
   609			goto out;
   610		}
   611	
   612		/* Creating a file in the .index dir. */
   613		index_dir_inode = d_inode(mi->mi_index_dir);
   614		inode_lock_nested(index_dir_inode, I_MUTEX_PARENT);
   615		error = vfs_create(index_dir_inode, index_file_dentry, args.mode | 0222,
   616				   true);
   617		inode_unlock(index_dir_inode);
   618	
   619		if (error)
   620			goto out;
   621		if (!d_really_is_positive(index_file_dentry)) {
   622			error = -EINVAL;
   623			goto out;
   624		}
   625	
   626		error = chmod(index_file_dentry, args.mode | 0222);
   627		if (error) {
   628			pr_debug("incfs: chmod err: %d\n", error);
   629			goto delete_index_file;
   630		}
   631	
   632		/* Save the file's ID as an xattr for easy fetching in future. */
   633		error = vfs_setxattr(index_file_dentry, INCFS_XATTR_ID_NAME,
   634			file_id_str, strlen(file_id_str), XATTR_CREATE);
   635		if (error) {
   636			pr_debug("incfs: vfs_setxattr err:%d\n", error);
   637			goto delete_index_file;
   638		}
   639	
   640		/* Save the file's size as an xattr for easy fetching in future. */
   641		size_attr_value = cpu_to_le64(args.size);
   642		error = vfs_setxattr(index_file_dentry, INCFS_XATTR_SIZE_NAME,
   643			(char *)&size_attr_value, sizeof(size_attr_value),
   644			XATTR_CREATE);
   645		if (error) {
   646			pr_debug("incfs: vfs_setxattr err:%d\n", error);
   647			goto delete_index_file;
   648		}
   649	
   650		/* Save the file's attribute as an xattr */
   651		if (args.file_attr_len && args.file_attr) {
   652			if (args.file_attr_len > INCFS_MAX_FILE_ATTR_SIZE) {
   653				error = -E2BIG;
   654				goto delete_index_file;
   655			}
   656	
   657			attr_value = kmalloc(args.file_attr_len, GFP_NOFS);
   658			if (!attr_value) {
   659				error = -ENOMEM;
   660				goto delete_index_file;
   661			}
   662	
   663			if (copy_from_user(attr_value,
   664					u64_to_user_ptr(args.file_attr),
   665					args.file_attr_len) > 0) {
   666				error = -EFAULT;
   667				goto delete_index_file;
   668			}
   669	
   670			error = vfs_setxattr(index_file_dentry,
   671					INCFS_XATTR_METADATA_NAME,
   672					attr_value, args.file_attr_len,
   673					XATTR_CREATE);
   674	
   675			if (error)
   676				goto delete_index_file;
   677		}
   678	
   679		/* Initializing a newly created file. */
   680		error = init_new_file(mi, index_file_dentry, &args.file_id, args.size,
   681				      range(attr_value, args.file_attr_len),
 > 682				      (u8 __user *)args.signature_info,
   683				      args.signature_size);
   684		if (error)
   685			goto delete_index_file;
   686	
   687		/* Linking a file with its real name from the requested dir. */
   688		error = incfs_link(index_file_dentry, named_file_dentry);
   689	
   690		if (!error)
   691			goto out;
   692	
   693	delete_index_file:
   694		incfs_unlink(index_file_dentry);
   695	
   696	out:
   697		if (error)
   698			pr_debug("incfs: %s err:%d\n", __func__, error);
   699	
   700		kfree(file_id_str);
   701		kfree(file_name);
   702		kfree(attr_value);
   703		dput(named_file_dentry);
   704		dput(index_file_dentry);
   705		path_put(&parent_dir_path);
   706		if (locked)
   707			mutex_unlock(&mi->mi_dir_struct_mutex);
   708		return error;
   709	}
   710	

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

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

only message in thread, other threads:[~2023-02-14 22:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-14 22:12 [android-common:android12-trusty-5.10 1415/7892] fs/incfs/pseudo_files.c:682:31: warning: cast to pointer from integer of different size 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;
as well as URLs for NNTP newsgroup(s).