tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: bc8198dc7ebc492ec3e9fa1617dcdfbe98e73b17 commit: cb0f01beb16669e91510fcdb2cea213931aee017 mm/mprotect: fix dax pud handlings date: 5 months ago config: alpha-randconfig-r112-20250124 (https://download.01.org/0day-ci/archive/20250124/202501241212.q9AAshQc-lkp@xxxxxxxxx/config) compiler: alpha-linux-gcc (GCC) 14.2.0 reproduce: (https://download.01.org/0day-ci/archive/20250124/202501241212.q9AAshQc-lkp@xxxxxxxxx/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@xxxxxxxxx> | Closes: https://lore.kernel.org/oe-kbuild-all/202501241212.q9AAshQc-lkp@xxxxxxxxx/ sparse warnings: (new ones prefixed by >>) mm/mprotect.c: note: in included file (through include/linux/mm.h, include/linux/pagewalk.h): include/linux/pgtable.h:317:16: sparse: sparse: cast to non-scalar include/linux/pgtable.h:317:16: sparse: sparse: cast from non-scalar include/linux/pgtable.h:317:16: sparse: sparse: cast to non-scalar include/linux/pgtable.h:317:16: sparse: sparse: cast from non-scalar mm/mprotect.c:291:9: sparse: sparse: context imbalance in 'change_pte_range' - unexpected unlock >> mm/mprotect.c:450:23: sparse: sparse: cast to non-scalar >> mm/mprotect.c:450:23: sparse: sparse: cast from non-scalar include/linux/pgtable.h:324:16: sparse: sparse: cast to non-scalar include/linux/pgtable.h:324:16: sparse: sparse: cast from non-scalar mm/mprotect.c:480:47: sparse: sparse: self-comparison always evaluates to false mm/mprotect.c:506:46: sparse: sparse: self-comparison always evaluates to false include/linux/pgtable.h:317:16: sparse: sparse: cast to non-scalar include/linux/pgtable.h:317:16: sparse: sparse: cast from non-scalar include/linux/pgtable.h:317:16: sparse: sparse: cast to non-scalar include/linux/pgtable.h:317:16: sparse: sparse: cast from non-scalar vim +450 mm/mprotect.c 428 429 static inline long change_pud_range(struct mmu_gather *tlb, 430 struct vm_area_struct *vma, p4d_t *p4d, unsigned long addr, 431 unsigned long end, pgprot_t newprot, unsigned long cp_flags) 432 { 433 struct mmu_notifier_range range; 434 pud_t *pudp, pud; 435 unsigned long next; 436 long pages = 0, ret; 437 438 range.start = 0; 439 440 pudp = pud_offset(p4d, addr); 441 do { 442 again: 443 next = pud_addr_end(addr, end); 444 ret = change_prepare(vma, pudp, pmd, addr, cp_flags); 445 if (ret) { 446 pages = ret; 447 break; 448 } 449 > 450 pud = READ_ONCE(*pudp); 451 if (pud_none(pud)) 452 continue; 453 454 if (!range.start) { 455 mmu_notifier_range_init(&range, 456 MMU_NOTIFY_PROTECTION_VMA, 0, 457 vma->vm_mm, addr, end); 458 mmu_notifier_invalidate_range_start(&range); 459 } 460 461 if (pud_leaf(pud)) { 462 if ((next - addr != PUD_SIZE) || 463 pgtable_split_needed(vma, cp_flags)) { 464 __split_huge_pud(vma, pudp, addr); 465 goto again; 466 } else { 467 ret = change_huge_pud(tlb, vma, pudp, 468 addr, newprot, cp_flags); 469 if (ret == 0) 470 goto again; 471 /* huge pud was handled */ 472 if (ret == HPAGE_PUD_NR) 473 pages += HPAGE_PUD_NR; 474 continue; 475 } 476 } 477 478 pages += change_pmd_range(tlb, vma, pudp, addr, next, newprot, 479 cp_flags); 480 } while (pudp++, addr = next, addr != end); 481 482 if (range.start) 483 mmu_notifier_invalidate_range_end(&range); 484 485 return pages; 486 } 487 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki