gfs2.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: gfs2@lists.linux.dev
Subject: Re: [bug report] gfs2: Convert gfs2_jhead_process_page() to use a folio
Date: Thu, 12 Oct 2023 16:27:55 +0100	[thread overview]
Message-ID: <ZSgQe27OCfUpmsbS@casper.infradead.org> (raw)
In-Reply-To: <fb027038-46ee-49fa-be1f-28926e7e2387@moroto.mountain>

On Thu, Oct 12, 2023 at 12:43:34PM +0300, Dan Carpenter wrote:
> Hello Matthew Wilcox (Oracle),
> 
> The patch 240159077d00: "gfs2: Convert gfs2_jhead_process_page() to
> use a folio" from May 13, 2022 (linux-next), leads to the following
> Smatch static checker warning:
> 
> 	fs/gfs2/lops.c:485 gfs2_jhead_process_page()
> 	error: 'folio' dereferencing possible ERR_PTR()
> 
> fs/gfs2/lops.c
>     469 static void gfs2_jhead_process_page(struct gfs2_jdesc *jd, unsigned long index,
>     470                                     struct gfs2_log_header_host *head,
>     471                                     bool *done)
>     472 {
>     473         struct folio *folio;
>     474 
>     475         folio = filemap_get_folio(jd->jd_inode->i_mapping, index);
> 
> Does filemap_get_folio() need to be checked for errors?

In this specific case, we know that the folio is there and will always
be returned.  See the comment on line 484.  Can I annotate this call so
that the tool knows this is a special case and doesn't warn about it?

>     476 
>     477         folio_wait_locked(folio);
>     478         if (folio_test_error(folio))
>     479                 *done = true;
>     480 
>     481         if (!*done)
>     482                 *done = gfs2_jhead_pg_srch(jd, head, &folio->page);
>     483 
>     484         /* filemap_get_folio() and the earlier grab_cache_page() */
> --> 485         folio_put_refs(folio, 2);
>     486 }
> 
> regards,
> dan carpenter

  reply	other threads:[~2023-10-12 15:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12  9:43 [bug report] gfs2: Convert gfs2_jhead_process_page() to use a folio Dan Carpenter
2023-10-12 15:27 ` Matthew Wilcox [this message]
2023-10-13  6:28   ` Dan Carpenter

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=ZSgQe27OCfUpmsbS@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=dan.carpenter@linaro.org \
    --cc=gfs2@lists.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).