Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/test_hmm: fix error path in dmirror_devmem_fault()
@ 2026-05-14  2:53 liuqiangneo
  2026-05-15  5:53 ` Alistair Popple
  0 siblings, 1 reply; 2+ messages in thread
From: liuqiangneo @ 2026-05-14  2:53 UTC (permalink / raw)
  To: jgg, leon; +Cc: akpm, linux-mm, linux-kernel, Qiang Liu

From: Qiang Liu <liuqiang@kylinos.cn>

Handle migrate_vma_setup() failure via goto err for unified cleanup.

Signed-off-by: Qiang Liu <liuqiang@kylinos.cn>
---
 lib/test_hmm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index 213504915737..5430ef97bbe0 100644
--- a/lib/test_hmm.c
+++ b/lib/test_hmm.c
@@ -1679,8 +1679,10 @@ static vm_fault_t dmirror_devmem_fault(struct vm_fault *vmf)
 	if (order)
 		args.flags |= MIGRATE_VMA_SELECT_COMPOUND;
 
-	if (migrate_vma_setup(&args))
-		return VM_FAULT_SIGBUS;
+	if (migrate_vma_setup(&args)) {
+		ret = VM_FAULT_SIGBUS;
+		goto err;
+	}
 
 	ret = dmirror_devmem_fault_alloc_and_copy(&args, dmirror);
 	if (ret)
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] lib/test_hmm: fix error path in dmirror_devmem_fault()
  2026-05-14  2:53 [PATCH] lib/test_hmm: fix error path in dmirror_devmem_fault() liuqiangneo
@ 2026-05-15  5:53 ` Alistair Popple
  0 siblings, 0 replies; 2+ messages in thread
From: Alistair Popple @ 2026-05-15  5:53 UTC (permalink / raw)
  To: liuqiangneo; +Cc: jgg, leon, akpm, linux-mm, linux-kernel, Qiang Liu

On 2026-05-14 at 12:53 +1000, liuqiangneo@163.com wrote...
> From: Qiang Liu <liuqiang@kylinos.cn>
> 
> Handle migrate_vma_setup() failure via goto err for unified cleanup.

In practice migrate_vma_setup() should never fail unless the test is wrong as it
just tests some static VMA properties. It might be nice to add a comment to that
effect, but the fix looks good so feel free to add:

Reviewed-by: Alistair Popple <apopple@nvidia.com>

 - Alistair

> Signed-off-by: Qiang Liu <liuqiang@kylinos.cn>
> ---
>  lib/test_hmm.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/test_hmm.c b/lib/test_hmm.c
> index 213504915737..5430ef97bbe0 100644
> --- a/lib/test_hmm.c
> +++ b/lib/test_hmm.c
> @@ -1679,8 +1679,10 @@ static vm_fault_t dmirror_devmem_fault(struct vm_fault *vmf)
>  	if (order)
>  		args.flags |= MIGRATE_VMA_SELECT_COMPOUND;
>  
> -	if (migrate_vma_setup(&args))
> -		return VM_FAULT_SIGBUS;
> +	if (migrate_vma_setup(&args)) {
> +		ret = VM_FAULT_SIGBUS;
> +		goto err;
> +	}
>  
>  	ret = dmirror_devmem_fault_alloc_and_copy(&args, dmirror);
>  	if (ret)
> -- 
> 2.43.0
> 
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-15  5:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14  2:53 [PATCH] lib/test_hmm: fix error path in dmirror_devmem_fault() liuqiangneo
2026-05-15  5:53 ` Alistair Popple

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox