arch/arm64/mm/contpte.c:325:35: warning: passing argument 1 of 'contpte_align_down' discards 'const' qualifier from pointer target type

kernel test robot <[email protected]> Fri, 24 Jul 2026 18:25:22 +0200
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://github.com/intel-lab-lkp/linux/commits/Pedro-Falcato/mm-constify-generic-pte_get/20260724-184321
head:   06cbf73db932e6dbb5910dc4ec0bc7e2c43bfec6
commit: 86a49b691863bb937b4943cf77f83da58af4143e mm/arm64: constify pte_get*() and contpte get logic
date:   6 hours ago
config: arm64-allnoconfig-bpf (https://download.01.org/0day-ci/archive/20260724/[email protected]/config)
compiler: aarch64-linux-gnu-gcc (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260724/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

   arch/arm64/mm/contpte.c: In function 'contpte_ptep_get':
>> arch/arm64/mm/contpte.c:325:35: warning: passing argument 1 of 'contpte_align_down' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     325 |         ptep = contpte_align_down(ptep);
         |                                   ^~~~
   arch/arm64/mm/contpte.c:24:48: note: expected 'pte_t *' but argument is of type 'const pte_t *'
      24 | static inline pte_t *contpte_align_down(pte_t *ptep)
         |                                         ~~~~~~~^~~~
   arch/arm64/mm/contpte.c: In function 'contpte_ptep_get_lockless':
   arch/arm64/mm/contpte.c:403:35: warning: passing argument 1 of 'contpte_align_down' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     403 |         ptep = contpte_align_down(orig_ptep);
         |                                   ^~~~~~~~~
   arch/arm64/mm/contpte.c:24:48: note: expected 'pte_t *' but argument is of type 'const pte_t *'
      24 | static inline pte_t *contpte_align_down(pte_t *ptep)
         |                                         ~~~~~~~^~~~


vim +325 arch/arm64/mm/contpte.c

4602e5757bcceb Ryan Roberts  2024-02-15  312  
86a49b691863bb Pedro Falcato 2026-07-24  313  pte_t contpte_ptep_get(const pte_t *ptep, pte_t orig_pte)
4602e5757bcceb Ryan Roberts  2024-02-15  314  {
4602e5757bcceb Ryan Roberts  2024-02-15  315  	/*
4602e5757bcceb Ryan Roberts  2024-02-15  316  	 * Gather access/dirty bits, which may be populated in any of the ptes
4602e5757bcceb Ryan Roberts  2024-02-15  317  	 * of the contig range. We are guaranteed to be holding the PTL, so any
4602e5757bcceb Ryan Roberts  2024-02-15  318  	 * contiguous range cannot be unfolded or otherwise modified under our
4602e5757bcceb Ryan Roberts  2024-02-15  319  	 * feet.
4602e5757bcceb Ryan Roberts  2024-02-15  320  	 */
4602e5757bcceb Ryan Roberts  2024-02-15  321  
4602e5757bcceb Ryan Roberts  2024-02-15  322  	pte_t pte;
4602e5757bcceb Ryan Roberts  2024-02-15  323  	int i;
4602e5757bcceb Ryan Roberts  2024-02-15  324  
4602e5757bcceb Ryan Roberts  2024-02-15 @325  	ptep = contpte_align_down(ptep);
4602e5757bcceb Ryan Roberts  2024-02-15  326  
4602e5757bcceb Ryan Roberts  2024-02-15  327  	for (i = 0; i < CONT_PTES; i++, ptep++) {
4602e5757bcceb Ryan Roberts  2024-02-15  328  		pte = __ptep_get(ptep);
4602e5757bcceb Ryan Roberts  2024-02-15  329  
093ae7a033cfde Xavier Xia    2025-06-24  330  		if (pte_dirty(pte)) {
4602e5757bcceb Ryan Roberts  2024-02-15  331  			orig_pte = pte_mkdirty(orig_pte);
093ae7a033cfde Xavier Xia    2025-06-24  332  			for (; i < CONT_PTES; i++, ptep++) {
093ae7a033cfde Xavier Xia    2025-06-24  333  				pte = __ptep_get(ptep);
093ae7a033cfde Xavier Xia    2025-06-24  334  				if (pte_young(pte)) {
093ae7a033cfde Xavier Xia    2025-06-24  335  					orig_pte = pte_mkyoung(orig_pte);
093ae7a033cfde Xavier Xia    2025-06-24  336  					break;
093ae7a033cfde Xavier Xia    2025-06-24  337  				}
093ae7a033cfde Xavier Xia    2025-06-24  338  			}
093ae7a033cfde Xavier Xia    2025-06-24  339  			break;
093ae7a033cfde Xavier Xia    2025-06-24  340  		}
4602e5757bcceb Ryan Roberts  2024-02-15  341  
093ae7a033cfde Xavier Xia    2025-06-24  342  		if (pte_young(pte)) {
4602e5757bcceb Ryan Roberts  2024-02-15  343  			orig_pte = pte_mkyoung(orig_pte);
093ae7a033cfde Xavier Xia    2025-06-24  344  			i++;
093ae7a033cfde Xavier Xia    2025-06-24  345  			ptep++;
093ae7a033cfde Xavier Xia    2025-06-24  346  			for (; i < CONT_PTES; i++, ptep++) {
093ae7a033cfde Xavier Xia    2025-06-24  347  				pte = __ptep_get(ptep);
093ae7a033cfde Xavier Xia    2025-06-24  348  				if (pte_dirty(pte)) {
093ae7a033cfde Xavier Xia    2025-06-24  349  					orig_pte = pte_mkdirty(orig_pte);
093ae7a033cfde Xavier Xia    2025-06-24  350  					break;
093ae7a033cfde Xavier Xia    2025-06-24  351  				}
093ae7a033cfde Xavier Xia    2025-06-24  352  			}
093ae7a033cfde Xavier Xia    2025-06-24  353  			break;
093ae7a033cfde Xavier Xia    2025-06-24  354  		}
4602e5757bcceb Ryan Roberts  2024-02-15  355  	}
4602e5757bcceb Ryan Roberts  2024-02-15  356  
4602e5757bcceb Ryan Roberts  2024-02-15  357  	return orig_pte;
4602e5757bcceb Ryan Roberts  2024-02-15  358  }
912609e96cd728 Ryan Roberts  2024-02-26  359  EXPORT_SYMBOL_GPL(contpte_ptep_get);
4602e5757bcceb Ryan Roberts  2024-02-15  360  

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