Re: [PATCH] fs/proc: Fix compile warning about variable 'vmcore_mmap_ops'

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

 



On Thu, 31 Oct 2024 15:27:46 +0800 Qi Xi <xiqi2@xxxxxxxxxx> wrote:

> When build with !CONFIG_MMU, the variable 'vmcore_mmap_ops'
> is defined but not used:
> 
> >> fs/proc/vmcore.c:458:42: warning: unused variable 'vmcore_mmap_ops'
>      458 | static const struct vm_operations_struct vmcore_mmap_ops = {
> 
> Fix this by declaring it __maybe_unused.
> 

It's better to move the definition inside #ifdef CONFIG_MMU, perhaps this:

--- a/fs/proc/vmcore.c~a
+++ a/fs/proc/vmcore.c
@@ -457,10 +457,6 @@ static vm_fault_t mmap_vmcore_fault(stru
 #endif
 }
 
-static const struct vm_operations_struct vmcore_mmap_ops = {
-	.fault = mmap_vmcore_fault,
-};
-
 /**
  * vmcore_alloc_buf - allocate buffer in vmalloc memory
  * @size: size of buffer
@@ -488,6 +484,11 @@ static inline char *vmcore_alloc_buf(siz
  * virtually contiguous user-space in ELF layout.
  */
 #ifdef CONFIG_MMU
+
+static const struct vm_operations_struct vmcore_mmap_ops = {
+	.fault = mmap_vmcore_fault,
+};
+
 /*
  * remap_oldmem_pfn_checked - do remap_oldmem_pfn_range replacing all pages
  * reported as not being ram with the zero page.
_


Please check and test that and send it back at us a a v2 patch?




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux