gfs2.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: gfs2@lists.linux.dev
Subject: Re: [bug report] gfs2: Convert gfs2_jhead_process_page() to use a folio
Date: Fri, 13 Oct 2023 09:28:32 +0300	[thread overview]
Message-ID: <efb41d72-c254-46b6-8de5-dcd9d3ef8887@kadam.mountain> (raw)
In-Reply-To: <ZSgQe27OCfUpmsbS@casper.infradead.org>

On Thu, Oct 12, 2023 at 04:27:55PM +0100, Matthew Wilcox wrote:
> 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?
> 

Thanks for looking at this.  There is no annotation.  In the kernel we
are very good at fixing static checker warnings so everything old is a
false positive.

This one is from May but I recently changed how dereferences were
handled so it's the first time I had seen the warning.

regards,
dan carpenter


      reply	other threads:[~2023-10-13  6: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
2023-10-13  6:28   ` Dan Carpenter [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=efb41d72-c254-46b6-8de5-dcd9d3ef8887@kadam.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=gfs2@lists.linux.dev \
    --cc=willy@infradead.org \
    /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).