linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: hugetlb: checking for IS_ERR() instead of NULL
@ 2021-06-01  9:25 Dan Carpenter
  2021-06-01 10:52 ` Mina Almasry
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-06-01  9:25 UTC (permalink / raw)
  To: Mike Kravetz, Mina Almasry
  Cc: Andrew Morton, Stephen Rothwell, linux-mm, linux-kernel, kernel-janitors

The alloc_migrate_huge_page() doesn't return error pointers, it returns
NULL.

Fixes: ab45bc8b5910 ("mm, hugetlb: fix resv_huge_pages underflow on UFFDIO_COPY")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 mm/hugetlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 69a4b551c157..3221c94b4749 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -5103,7 +5103,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
 			 */
 			page = alloc_migrate_huge_page(h, gfp_mask, node,
 						       nodemask);
-			if (IS_ERR(page)) {
+			if (!page) {
 				ret = -ENOMEM;
 				goto out;
 			}
-- 
2.30.2


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

* Re: [PATCH] mm: hugetlb: checking for IS_ERR() instead of NULL
  2021-06-01  9:25 [PATCH] mm: hugetlb: checking for IS_ERR() instead of NULL Dan Carpenter
@ 2021-06-01 10:52 ` Mina Almasry
  0 siblings, 0 replies; 2+ messages in thread
From: Mina Almasry @ 2021-06-01 10:52 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Mike Kravetz, Andrew Morton, Stephen Rothwell, Linux-MM,
	open list, kernel-janitors

On Tue, Jun 1, 2021 at 2:26 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> The alloc_migrate_huge_page() doesn't return error pointers, it returns
> NULL.
>
> Fixes: ab45bc8b5910 ("mm, hugetlb: fix resv_huge_pages underflow on UFFDIO_COPY")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  mm/hugetlb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Gah, my bad.

Reviewed-by: Mina Almasry <almasrymina@google.com>

> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 69a4b551c157..3221c94b4749 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -5103,7 +5103,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
>                          */
>                         page = alloc_migrate_huge_page(h, gfp_mask, node,
>                                                        nodemask);
> -                       if (IS_ERR(page)) {
> +                       if (!page) {
>                                 ret = -ENOMEM;
>                                 goto out;
>                         }
> --
> 2.30.2
>

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

end of thread, other threads:[~2021-06-01 10:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01  9:25 [PATCH] mm: hugetlb: checking for IS_ERR() instead of NULL Dan Carpenter
2021-06-01 10:52 ` Mina Almasry

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).