All of lore.kernel.org
 help / color / mirror / Atom feed
* [davidhildenbrand:pfn_cow 3/5] arch/x86/mm/pat/memtype.c:199:36: warning: right shift count >= width of type
@ 2024-03-08 11:28 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-03-08 11:28 UTC (permalink / raw)
  To: David Hildenbrand; +Cc: oe-kbuild-all

tree:   https://github.com/davidhildenbrand/linux pfn_cow
head:   e522fd14b455b4012d7c9388026dc849daf6f8b5
commit: 17725734e525b4cc4ae1f26107e45c0ca19c17a6 [3/5] x86/mm/pat: store PAT information for VM_PAT in VMA
config: i386-buildonly-randconfig-003-20240308 (https://download.01.org/0day-ci/archive/20240308/202403081901.TbUIkbal-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240308/202403081901.TbUIkbal-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/202403081901.TbUIkbal-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from arch/x86/include/asm/bug.h:87,
                    from include/linux/bug.h:5,
                    from include/linux/fortify-string.h:5,
                    from include/linux/string.h:292,
                    from include/linux/seq_file.h:6,
                    from arch/x86/mm/pat/memtype.c:34:
   arch/x86/mm/pat/memtype.c: In function 'vma_set_pat_info':
>> arch/x86/mm/pat/memtype.c:199:36: warning: right shift count >= width of type [-Wshift-count-overflow]
     199 |         WARN_ON_ONCE(vma->vm_pgoff >> 61);
         |                                    ^~
   include/asm-generic/bug.h:111:32: note: in definition of macro 'WARN_ON_ONCE'
     111 |         int __ret_warn_on = !!(condition);                      \
         |                                ^~~~~~~~~


vim +199 arch/x86/mm/pat/memtype.c

   178	
   179	static inline void vma_set_pat_info(struct vm_area_struct *vma,
   180					    resource_size_t paddr, pgprot_t pgprot)
   181	{
   182		const int64_t diff = (paddr >> PAGE_SHIFT) - vma->vm_pgoff;
   183	
   184		/*
   185		 * With VM_PAT, we will indicate that the whole VMA maps a contiguous
   186		 * PFN range. To avoid walking page tables, we store the start PFN
   187		 * and the requested cachemode in the VMA.
   188		 *
   189		 * In order to obtain the start PFN in a VMA even after the VMA was
   190		 * split or mremapped without additional hooks, store the diff
   191		 * of the PFN to the vm_pgoff. Merging o extending VMAs does not apply
   192		 * to "special" mappings.
   193		 *
   194		 * If our vm_pgoff would exceed 61 bit, we would not be able to reuse
   195		 * 3 bit for our cachemode. We really don't expect that big vm_pgoffs
   196		 * in VM_PFNMAP mappings, so let's keep it simple and avoid storing
   197		 * the cachemode separately.
   198		 */
 > 199		WARN_ON_ONCE(vma->vm_pgoff >> 61);
   200		BUILD_BUG_ON((_PAGE_CACHE_MODE_NUM - 1) & ~0x7);
   201	
   202		vm_flags_set(vma, VM_PAT);
   203		vma->pat_info = (diff << 3) | pgprot2cachemode(pgprot);
   204	}
   205	

-- 
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:[~2024-03-08 11:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-08 11:28 [davidhildenbrand:pfn_cow 3/5] arch/x86/mm/pat/memtype.c:199:36: warning: right shift count >= width of type 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.