All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: David Hildenbrand <david@redhat.com>
Cc: oe-kbuild-all@lists.linux.dev
Subject: [davidhildenbrand:pfn_cow 3/5] arch/x86/mm/pat/memtype.c:199:36: warning: right shift count >= width of type
Date: Fri, 8 Mar 2024 19:28:04 +0800	[thread overview]
Message-ID: <202403081901.TbUIkbal-lkp@intel.com> (raw)

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

                 reply	other threads:[~2024-03-08 11:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202403081901.TbUIkbal-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=david@redhat.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.