All of lore.kernel.org
 help / color / mirror / Atom feed
* [openeuler:OLK-6.6 3195/3195] fs/mfs/data.c:185:24: warning: default initialization of an object of type 'struct vm_area_struct' with const member leaves the object uninitialized
@ 2025-11-15 19:17 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2025-11-15 19:17 UTC (permalink / raw)
  To: kernel, Huang Xiaojia; +Cc: oe-kbuild-all

tree:   https://gitee.com/openeuler/kernel.git OLK-6.6
head:   3abd440f300fe9312974a2d65499ca4ff872363a
commit: 693388489ac5689392e98cf86f58f115ffa9c9ce [3195/3195] mfs: Add basic data operation for MFS
config: loongarch-allyesconfig (https://download.01.org/0day-ci/archive/20251116/202511160338.SRwmoKy5-lkp@intel.com/config)
compiler: clang version 22.0.0git (https://github.com/llvm/llvm-project 0bba1e76581bad04e7d7f09f5115ae5e2989e0d9)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251116/202511160338.SRwmoKy5-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/202511160338.SRwmoKy5-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/mfs/data.c:185:24: warning: default initialization of an object of type 'struct vm_area_struct' with const member leaves the object uninitialized [-Wdefault-const-init-field-unsafe]
     185 |         struct vm_area_struct cvma, *vma, **vma_;
         |                               ^
   include/linux/mm_types.h:659:20: note: member 'vm_flags' declared 'const' here
     659 |                 const vm_flags_t vm_flags;
         |                                  ^
   fs/mfs/data.c:220:24: warning: default initialization of an object of type 'struct vm_area_struct' with const member leaves the object uninitialized [-Wdefault-const-init-field-unsafe]
     220 |         struct vm_area_struct cvma, *vma, **vma_;
         |                               ^
   include/linux/mm_types.h:659:20: note: member 'vm_flags' declared 'const' here
     659 |                 const vm_flags_t vm_flags;
         |                                  ^
   fs/mfs/data.c:214:12: warning: no previous prototype for function 'mfs_filemap_map_pages' [-Wmissing-prototypes]
     214 | vm_fault_t mfs_filemap_map_pages(struct vm_fault *vmf,
         |            ^
   fs/mfs/data.c:214:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     214 | vm_fault_t mfs_filemap_map_pages(struct vm_fault *vmf,
         | ^
         | static 
   3 warnings generated.


vim +185 fs/mfs/data.c

   179	
   180	static vm_fault_t mfs_filemap_fault(struct vm_fault *vmf)
   181	{
   182		struct file *cfile, *file = vmf->vma->vm_file;
   183		struct mfs_file_info *fi = file->private_data;
   184		const struct vm_operations_struct *cvm_ops;
 > 185		struct vm_area_struct cvma, *vma, **vma_;
   186		vm_fault_t ret;
   187	
   188		vma = vmf->vma;
   189		memcpy(&cvma, vma, sizeof(struct vm_area_struct));
   190		cfile = fi->cache;
   191		cvm_ops = fi->cache_vm_ops;
   192		cvma.vm_file = cfile;
   193	
   194		if (unlikely(!cvm_ops->fault))
   195			return VM_FAULT_SIGBUS;
   196	
   197		(void)get_file(cfile);
   198	
   199		/*
   200		 * Dealing fault in mfs will call cachefile's fault eventually,
   201		 * hence we will change vmf->vma->vm_file to cachefile.
   202		 * When faulting concurrently, changing vmf->vma->vm_file is
   203		 * visible to other threads. Hence we use cvma to narrow the
   204		 * visibility. vmf->vma is const, so we use **vma_ to change.
   205		 */
   206		vma_ = (struct vm_area_struct **)&vmf->vma;
   207		*vma_ = &cvma;
   208		ret = cvm_ops->fault(vmf);
   209		*vma_ = vma;
   210		fput(cfile);
   211		return ret;
   212	}
   213	

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

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

only message in thread, other threads:[~2025-11-15 19:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-15 19:17 [openeuler:OLK-6.6 3195/3195] fs/mfs/data.c:185:24: warning: default initialization of an object of type 'struct vm_area_struct' with const member leaves the object uninitialized 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.