linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] mm/hmm/test: fix error return code in hmm_dmirror_init()
@ 2020-05-09  3:02 Wei Yongjun
  2020-05-11 17:20 ` Ralph Campbell
  2020-05-12 19:59 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Wei Yongjun @ 2020-05-09  3:02 UTC (permalink / raw)
  To: jglisse, Ralph Campbell
  Cc: Wei Yongjun, linux-mm, linux-kernel, kernel-janitors, Hulk Robot

Fix to return negative error code -ENOMEM from the alloc_page() error
handling case instead of 0, as done elsewhere in this function.

Fixes: 5d5e54be8a1e ("mm/hmm/test: add selftest driver for HMM")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 lib/test_hmm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/test_hmm.c b/lib/test_hmm.c
index 00bca6116f93..b4d9434e49e7 100644
--- a/lib/test_hmm.c
+++ b/lib/test_hmm.c
@@ -1119,8 +1119,10 @@ static int __init hmm_dmirror_init(void)
 	 * make the code here simpler (i.e., we need a struct page for it).
 	 */
 	dmirror_zero_page = alloc_page(GFP_HIGHUSER | __GFP_ZERO);
-	if (!dmirror_zero_page)
+	if (!dmirror_zero_page) {
+		ret = -ENOMEM;
 		goto err_chrdev;
+	}
 
 	pr_info("HMM test module loaded. This is only for testing HMM.\n");
 	return 0;




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

* Re: [PATCH -next] mm/hmm/test: fix error return code in hmm_dmirror_init()
  2020-05-09  3:02 [PATCH -next] mm/hmm/test: fix error return code in hmm_dmirror_init() Wei Yongjun
@ 2020-05-11 17:20 ` Ralph Campbell
  2020-05-12 19:59 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Ralph Campbell @ 2020-05-11 17:20 UTC (permalink / raw)
  To: Wei Yongjun, jglisse; +Cc: linux-mm, linux-kernel, kernel-janitors, Hulk Robot


On 5/8/20 8:02 PM, Wei Yongjun wrote:
> Fix to return negative error code -ENOMEM from the alloc_page() error
> handling case instead of 0, as done elsewhere in this function.
> 
> Fixes: 5d5e54be8a1e ("mm/hmm/test: add selftest driver for HMM")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Looks good, thanks!
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>

> ---
>   lib/test_hmm.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/test_hmm.c b/lib/test_hmm.c
> index 00bca6116f93..b4d9434e49e7 100644
> --- a/lib/test_hmm.c
> +++ b/lib/test_hmm.c
> @@ -1119,8 +1119,10 @@ static int __init hmm_dmirror_init(void)
>   	 * make the code here simpler (i.e., we need a struct page for it).
>   	 */
>   	dmirror_zero_page = alloc_page(GFP_HIGHUSER | __GFP_ZERO);
> -	if (!dmirror_zero_page)
> +	if (!dmirror_zero_page) {
> +		ret = -ENOMEM;
>   		goto err_chrdev;
> +	}
>   
>   	pr_info("HMM test module loaded. This is only for testing HMM.\n");
>   	return 0;
> 
> 
> 

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

* Re: [PATCH -next] mm/hmm/test: fix error return code in hmm_dmirror_init()
  2020-05-09  3:02 [PATCH -next] mm/hmm/test: fix error return code in hmm_dmirror_init() Wei Yongjun
  2020-05-11 17:20 ` Ralph Campbell
@ 2020-05-12 19:59 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2020-05-12 19:59 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: jglisse, Ralph Campbell, linux-mm, linux-kernel, kernel-janitors,
	Hulk Robot

On Sat, May 09, 2020 at 03:02:34AM +0000, Wei Yongjun wrote:
> Fix to return negative error code -ENOMEM from the alloc_page() error
> handling case instead of 0, as done elsewhere in this function.
> 
> Fixes: 5d5e54be8a1e ("mm/hmm/test: add selftest driver for HMM")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  lib/test_hmm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Thank you, I squashed this into the original commit

Jason

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

end of thread, other threads:[~2020-05-12 19:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-09  3:02 [PATCH -next] mm/hmm/test: fix error return code in hmm_dmirror_init() Wei Yongjun
2020-05-11 17:20 ` Ralph Campbell
2020-05-12 19:59 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).