linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sidhartha Kumar <sidhartha.kumar@oracle.com>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Mike Kravetz <mike.kravetz@oracle.com>,
	Muchun Song <muchun.song@linux.dev>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] hugetlbfs: fix an NULL vs IS_ERR() bug
Date: Thu, 28 Sep 2023 00:42:14 -0700	[thread overview]
Message-ID: <27812cb9-0f35-975b-5fb7-cf857a4be635@oracle.com> (raw)
In-Reply-To: <1772c296-1417-486f-8eef-171af2192681@moroto.mountain>

On 9/27/23 10:17 PM, Dan Carpenter wrote:
> This code was converted from using find_lock_page() which returns NULL,
> to calling filemap_lock_hugetlb_folio() which returns -ENOENT.  The
> check needs to be updated to match.  Also IS_ERR() has an unlikely()
> built in so we can remove that.
> 
> Fixes: 4649d8d5bb81 ("mm/filemap: remove hugetlb special casing in filemap.c")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> filemap_lock_hugetlb_folio() can return NULL if huge tables are disabled
> but that isn't the case here so there is no need to check for that.
> 
>   fs/hugetlbfs/inode.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
> index 3f2f0a4bfad0..91034b6e5b69 100644
> --- a/fs/hugetlbfs/inode.c
> +++ b/fs/hugetlbfs/inode.c
> @@ -354,7 +354,7 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to)
>   
>   		/* Find the folio */
>   		folio = filemap_lock_hugetlb_folio(h, mapping, index);
> -		if (unlikely(folio == NULL)) {
> +		if (IS_ERR(folio)) {
>   			/*
>   			 * We have a HOLE, zero out the user-buffer for the
>   			 * length of the hole or request.
Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>


      reply	other threads:[~2023-09-28  7:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28  5:17 Dan Carpenter
2023-09-28  7:42 ` Sidhartha Kumar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27812cb9-0f35-975b-5fb7-cf857a4be635@oracle.com \
    --to=sidhartha.kumar@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=muchun.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox