mm/memfd.c:452:26: sparse: sparse: Initializer entry defined twice
From: kernel test robot
Date: Thu Dec 03 2026 - 03:56:57 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d06ce6f1eb5eeffd4ebcfde345dc34a98131d106
commit: 094e94d13b606b820e3d1383e3a361f680ff023a memfd,selinux: call security_inode_init_security_anon()
date: 1 year, 1 month ago
config: um-randconfig-r2308-20261203 (https://download.01.org/0day-ci/archive/20261203/20261203094828.YwLaEPBb-lkp@xxxxxxxxx/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
sparse: v0.6.5-rc1-94-g0d159c10
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261203/20261203094828.YwLaEPBb-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
| Fixes: 094e94d13b60 ("memfd,selinux: call security_inode_init_security_anon()")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/20261203094828.YwLaEPBb-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
>> mm/memfd.c:452:26: sparse: sparse: Initializer entry defined twice
mm/memfd.c:452:26: sparse: also defined here
vim +452 mm/memfd.c
431
432 static struct file *alloc_file(const char *name, unsigned int flags)
433 {
434 unsigned int *file_seals;
435 struct file *file;
436 struct inode *inode;
437 int err = 0;
438
439 if (flags & MFD_HUGETLB) {
440 file = hugetlb_file_setup(name, 0, VM_NORESERVE,
441 HUGETLB_ANONHUGE_INODE,
442 (flags >> MFD_HUGE_SHIFT) &
443 MFD_HUGE_MASK);
444 } else {
445 file = shmem_file_setup(name, 0, VM_NORESERVE);
446 }
447 if (IS_ERR(file))
448 return file;
449
450 inode = file_inode(file);
451 err = security_inode_init_security_anon(inode,
> 452 &QSTR(MEMFD_ANON_NAME), NULL);
453 if (err) {
454 fput(file);
455 file = ERR_PTR(err);
456 return file;
457 }
458
459 file->f_mode |= FMODE_LSEEK | FMODE_PREAD | FMODE_PWRITE;
460 file->f_flags |= O_LARGEFILE;
461
462 if (flags & MFD_NOEXEC_SEAL) {
463 inode->i_mode &= ~0111;
464 file_seals = memfd_file_seals_ptr(file);
465 if (file_seals) {
466 *file_seals &= ~F_SEAL_SEAL;
467 *file_seals |= F_SEAL_EXEC;
468 }
469 } else if (flags & MFD_ALLOW_SEALING) {
470 /* MFD_EXEC and MFD_ALLOW_SEALING are set */
471 file_seals = memfd_file_seals_ptr(file);
472 if (file_seals)
473 *file_seals &= ~F_SEAL_SEAL;
474 }
475
476 return file;
477 }
478
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki