[linux-next:master 8592/13518] fs/tracefs/event_inode.c:734:10: error: casting from randomized structure pointer type 'struct dentry *' to 'struct eventfs_inode *'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   4230ea146b1e64628f11e44290bb4008e391bc24
commit: 5790b1fb3d672d9a1fe3881a7181dfdbe741568f [8592/13518] eventfs: Remove eventfs_file and just use eventfs_inode
config: hexagon-randconfig-r001-20230603 (https://download.01.org/0day-ci/archive/20231020/202310200550.p46bE4w7-lkp@xxxxxxxxx/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231020/202310200550.p46bE4w7-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310200550.p46bE4w7-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> fs/tracefs/event_inode.c:734:10: error: casting from randomized structure pointer type 'struct dentry *' to 'struct eventfs_inode *'
                   return (struct eventfs_inode *)dentry;
                          ^
   fs/tracefs/event_inode.c:909:6: warning: no previous prototype for function 'eventfs_remove_events_dir' [-Wmissing-prototypes]
   void eventfs_remove_events_dir(struct dentry *dentry)
        ^
   fs/tracefs/event_inode.c:909:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   void eventfs_remove_events_dir(struct dentry *dentry)
   ^
   static 
   1 warning and 1 error generated.


vim +734 fs/tracefs/event_inode.c

   710	
   711	/**
   712	 * eventfs_create_events_dir - create the top level events directory
   713	 * @name: The name of the top level directory to create.
   714	 * @parent: Parent dentry for this file in the tracefs directory.
   715	 * @entries: A list of entries that represent the files under this directory
   716	 * @size: The number of @entries
   717	 * @data: The default data to pass to the files (an entry may override it).
   718	 *
   719	 * This function creates the top of the trace event directory.
   720	 */
   721	struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry *parent,
   722							const struct eventfs_entry *entries,
   723							int size, void *data)
   724	{
   725		struct dentry *dentry = tracefs_start_creating(name, parent);
   726		struct eventfs_inode *ei;
   727		struct tracefs_inode *ti;
   728		struct inode *inode;
   729	
   730		if (security_locked_down(LOCKDOWN_TRACEFS))
   731			return NULL;
   732	
   733		if (IS_ERR(dentry))
 > 734			return (struct eventfs_inode *)dentry;
   735	
   736		ei = kzalloc(sizeof(*ei), GFP_KERNEL);
   737		if (!ei)
   738			goto fail;
   739	
   740		inode = tracefs_get_inode(dentry->d_sb);
   741		if (unlikely(!inode))
   742			goto fail;
   743	
   744		if (size) {
   745			ei->d_children = kzalloc(sizeof(*ei->d_children) * size, GFP_KERNEL);
   746			if (!ei->d_children)
   747				goto fail;
   748		}
   749	
   750		ei->dentry = dentry;
   751		ei->entries = entries;
   752		ei->nr_entries = size;
   753		ei->data = data;
   754		ei->name = kstrdup_const(name, GFP_KERNEL);
   755		if (!ei->name)
   756			goto fail;
   757	
   758		INIT_LIST_HEAD(&ei->children);
   759		INIT_LIST_HEAD(&ei->list);
   760	
   761		ti = get_tracefs(inode);
   762		ti->flags |= TRACEFS_EVENT_INODE | TRACEFS_EVENT_TOP_INODE;
   763		ti->private = ei;
   764	
   765		inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
   766		inode->i_op = &eventfs_root_dir_inode_operations;
   767		inode->i_fop = &eventfs_file_operations;
   768	
   769		/* directory inodes start off with i_nlink == 2 (for "." entry) */
   770		inc_nlink(inode);
   771		d_instantiate(dentry, inode);
   772		inc_nlink(dentry->d_parent->d_inode);
   773		fsnotify_mkdir(dentry->d_parent->d_inode, dentry);
   774		tracefs_end_creating(dentry);
   775	
   776		/* Will call dput when the directory is removed */
   777		dget(dentry);
   778	
   779		return ei;
   780	
   781	 fail:
   782		kfree(ei->d_children);
   783		kfree(ei);
   784		tracefs_failed_creating(dentry);
   785		return ERR_PTR(-ENOMEM);
   786	}
   787	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux