linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: David Howells <dhowells@redhat.com>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: Re: [bug report] mm: Provide a means of invalidation without using launder_folio
Date: Thu, 13 Jun 2024 15:56:23 +0100	[thread overview]
Message-ID: <ZmsIl5y3-RKtlxVZ@casper.infradead.org> (raw)
In-Reply-To: <8b6bd8e0-04a2-4b51-9b29-74804ba11564@moroto.mountain>

On Thu, Jun 13, 2024 at 04:55:30PM +0300, Dan Carpenter wrote:
> Hello David Howells,
> 
> Commit 74e797d79cf1 ("mm: Provide a means of invalidation without
> using launder_folio") from Mar 27, 2024 (linux-next), leads to the
> following Smatch static checker warning:
> 
> 	mm/filemap.c:4229 filemap_invalidate_inode()
> 	error: we previously assumed 'mapping' could be null (see line 4200)

I think David has been overly cautious here.  I don't think i_mapping
can ever be NULL.  inode_init_always() sets i_mapping to be
&inode->i_data and I don't see anywhere that changes i_mapping to be
NULL.

> mm/filemap.c
>   4192  int filemap_invalidate_inode(struct inode *inode, bool flush,
>   4193                               loff_t start, loff_t end)
>   4194  {
>   4195          struct address_space *mapping = inode->i_mapping;
>   4196          pgoff_t first = start >> PAGE_SHIFT;
>   4197          pgoff_t last = end >> PAGE_SHIFT;
>   4198          pgoff_t nr = end == LLONG_MAX ? ULONG_MAX : last - first + 1;
>   4199  
>   4200          if (!mapping || !mapping->nrpages || end < start)
>                     ^^^^^^^^
> If mapping is NULL

       reply	other threads:[~2024-06-13 14:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8b6bd8e0-04a2-4b51-9b29-74804ba11564@moroto.mountain>
2024-06-13 14:56 ` Matthew Wilcox [this message]
2024-06-13 15:13   ` [bug report] mm: Provide a means of invalidation without using launder_folio Dan Carpenter
2024-06-13 15:27     ` Matthew Wilcox

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=ZmsIl5y3-RKtlxVZ@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=dan.carpenter@linaro.org \
    --cc=dhowells@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.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 NNTP newsgroup(s).