Re: [akpm-mm:mm-new] BUILD SUCCESS WITH UNVERIFIED WARNING e0ffd277b09a7c9f1a436e5f75be37ac490bc59f

Andrew Morton <[email protected]>
Newsgroups org.kernel.vger.mm-commits,org.kvack.linux-mm
Message-ID <[email protected]>
On Mon, 10 Aug 2026 10:44:13 +0800 kernel test robot <[email protected]> wrote:

> tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git mm-new
> branch HEAD: e0ffd277b09a7c9f1a436e5f75be37ac490bc59f  mm/swap, PM: hibernate: atomically replace hibernation pin
> 
> Unverified Warning (likely false positive, kindly check if interested):
> 
>     https://lore.kernel.org/oe-kbuild/[email protected]
> 
>     mm/hmm.c:673 hmm_do_fault() error: we previously assumed 'hmm_vma_walk->locked' could be null (see line 654)
> 
> Warning ids grouped by kconfigs:

Thanks.  I assume this warning was produced by sparse?  The report
doesn't tell us this, and I suggest that it do so.

> recent_errors
> `-- s390-randconfig-r071-20260809
>     `-- mm-hmm.c-hmm_do_fault()-error:we-previously-assumed-hmm_vma_walk-locked-could-be-null-(see-line-)

Caused by

	121170831228 ("mm/hmm: add hmm_range_fault_unlocked_timeout() for mmap lock-drop support")


Stanislaw, you've previously said that this is a can't-happen, but boy
I'm getting tired of seeing this warning report.  Would the below change
hurt anything?  I can't immediately think of a cost-free way of doing
this.


From: Andrew Morton <[email protected]>
Subject: mm/hmm.c:hmm_do_fault(): suppress sparse warning
Date: Mon Aug 10 01:16:37 PM PDT 2026

mm/hmm.c:673 hmm_do_fault() error: we previously assumed 'hmm_vma_walk->locked' could be null (see line 654)

Stanislav says this can't happen.  Waste a few cycles to make the warning
go away.

Fixes: 121170831228 ("mm/hmm: add hmm_range_fault_unlocked_timeout() for mmap lock-drop support")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/[email protected]
Cc: Stanislav Kinsburskii <[email protected]>
Cc: David Hildenbrand <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---

 mm/hmm.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/mm/hmm.c~mm-hmmc-hmm_do_fault-suppress-sparse-warning
+++ a/mm/hmm.c
@@ -670,7 +670,8 @@ static int hmm_do_fault(struct mm_struct
 		ret = handle_mm_fault(vma, addr, fault_flags, NULL);
 
 		if (ret & (VM_FAULT_COMPLETED | VM_FAULT_RETRY)) {
-			*hmm_vma_walk->locked = false;
+			if (hmm_vma_walk->locked)	/* needed by sparse */
+				*hmm_vma_walk->locked = false;
 			return HMM_FAULT_UNLOCKED;
 		}
 
_
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.