On Thu, Feb 23, 2023 at 01:22:54PM +0000, Matthew Wilcox wrote:
But I'm suspicious of static match tools claiming it can't ever happen,
and I'd like more details please. I can't find the original report.
I would never write a warning like that... However at the time when
I reported the bug then Smatch did say that all the callers passed a
non-NULL file pointer. I've reviewed my logs and that was true when I
said it but it's not true now. :( Now Smatch says there are three
callers and nfs_write_begin() passes a valid pointer, read_pages()
passes either a valid pointer or a NULL and filemap_read_folio() passes
an unknown pointer.
https://lore.kernel.org/all/Y77+n9MyHgx%2FalA4@kadam/ (local)
The issue here is that the pointer was already derefernced on the lines
before the check for NULL.
struct inode *inode = file_inode(file);
So either the dereference or the check was wrong.
regards,
dan carpenter