linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [akpm-mm:mm-nonmm-unstable 129/139] mm/shmem.c:5811:23: warning: unused variable 'flags'
@ 2025-11-08  3:51 kernel test robot
  2025-11-08 16:43 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2025-11-08  3:51 UTC (permalink / raw)
  To: Pratyush Yadav
  Cc: oe-kbuild-all, Andrew Morton, Linux Memory Management List,
	Pasha Tatashin

Hi Pratyush,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
head:   2fa523fd0829356881811ce9553b707102f55bd3
commit: 730fb8720d1ba209cd74692ece9766101e1fdb56 [129/139] mm: shmem: use SHMEM_F_* flags instead of VM_* flags
config: m68k-allnoconfig (https://download.01.org/0day-ci/archive/20251108/202511081101.9sXNBrzT-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 15.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251108/202511081101.9sXNBrzT-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/202511081101.9sXNBrzT-lkp@intel.com/

All warnings (new ones prefixed by >>):

   mm/shmem.c: In function '__shmem_file_setup':
>> mm/shmem.c:5811:23: warning: unused variable 'flags' [-Wunused-variable]
    5811 |         unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0;
         |                       ^~~~~


vim +/flags +5811 mm/shmem.c

  5806	
  5807	static struct file *__shmem_file_setup(struct vfsmount *mnt, const char *name,
  5808					       loff_t size, unsigned long vm_flags,
  5809					       unsigned int i_flags)
  5810	{
> 5811		unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0;
  5812		struct inode *inode;
  5813		struct file *res;
  5814	
  5815		if (IS_ERR(mnt))
  5816			return ERR_CAST(mnt);
  5817	
  5818		if (size < 0 || size > MAX_LFS_FILESIZE)
  5819			return ERR_PTR(-EINVAL);
  5820	
  5821		if (is_idmapped_mnt(mnt))
  5822			return ERR_PTR(-EINVAL);
  5823	
  5824		if (shmem_acct_size(flags, size))
  5825			return ERR_PTR(-ENOMEM);
  5826	
  5827		inode = shmem_get_inode(&nop_mnt_idmap, mnt->mnt_sb, NULL,
  5828					S_IFREG | S_IRWXUGO, 0, vm_flags);
  5829		if (IS_ERR(inode)) {
  5830			shmem_unacct_size(flags, size);
  5831			return ERR_CAST(inode);
  5832		}
  5833		inode->i_flags |= i_flags;
  5834		inode->i_size = size;
  5835		clear_nlink(inode);	/* It is unlinked */
  5836		res = ERR_PTR(ramfs_nommu_expand_for_mapping(inode, size));
  5837		if (!IS_ERR(res))
  5838			res = alloc_file_pseudo(inode, mnt, name, O_RDWR,
  5839					&shmem_file_operations);
  5840		if (IS_ERR(res))
  5841			iput(inode);
  5842		return res;
  5843	}
  5844	

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [akpm-mm:mm-nonmm-unstable 129/139] mm/shmem.c:5811:23: warning: unused variable 'flags'
  2025-11-08  3:51 [akpm-mm:mm-nonmm-unstable 129/139] mm/shmem.c:5811:23: warning: unused variable 'flags' kernel test robot
@ 2025-11-08 16:43 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2025-11-08 16:43 UTC (permalink / raw)
  To: kernel test robot
  Cc: Pratyush Yadav, oe-kbuild-all, Linux Memory Management List,
	Pasha Tatashin

On Sat, 8 Nov 2025 11:51:06 +0800 kernel test robot <lkp@intel.com> wrote:

> FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-nonmm-unstable
> head:   2fa523fd0829356881811ce9553b707102f55bd3
> commit: 730fb8720d1ba209cd74692ece9766101e1fdb56 [129/139] mm: shmem: use SHMEM_F_* flags instead of VM_* flags
> config: m68k-allnoconfig (https://download.01.org/0day-ci/archive/20251108/202511081101.9sXNBrzT-lkp@intel.com/config)
> compiler: m68k-linux-gcc (GCC) 15.1.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251108/202511081101.9sXNBrzT-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/202511081101.9sXNBrzT-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
>    mm/shmem.c: In function '__shmem_file_setup':
> >> mm/shmem.c:5811:23: warning: unused variable 'flags' [-Wunused-variable]
>     5811 |         unsigned long flags = (vm_flags & VM_NORESERVE) ? SHMEM_F_NORESERVE : 0;
>          |                       ^~~~~

Yeah, thanks, that's reason #47 for using C instead of CPP.

--- a/mm/shmem.c~mm-shmem-use-shmem_f_-flags-instead-of-vm_-flags-fix
+++ a/mm/shmem.c
@@ -5818,8 +5818,15 @@ EXPORT_SYMBOL_GPL(shmem_truncate_range);
 #define shmem_vm_ops				generic_file_vm_ops
 #define shmem_anon_vm_ops			generic_file_vm_ops
 #define shmem_file_operations			ramfs_file_operations
-#define shmem_acct_size(flags, size)		0
-#define shmem_unacct_size(flags, size)		do {} while (0)
+
+static inline int shmem_acct_size(unsigned long flags, loff_t size)
+{
+	return 0;
+}
+
+static inline void shmem_unacct_size(unsigned long flags, loff_t size)
+{
+}
 
 static inline struct inode *shmem_get_inode(struct mnt_idmap *idmap,
 				struct super_block *sb, struct inode *dir,
_



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-08 16:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-08  3:51 [akpm-mm:mm-nonmm-unstable 129/139] mm/shmem.c:5811:23: warning: unused variable 'flags' kernel test robot
2025-11-08 16:43 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox