Skip to contentSkip to conversation

NFS: Convert buffered writes to use folios

bug report Dan Carpenter 1 participant 1 message Feb 23, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello Trond Myklebust,

This is a semi-automatic email about new static checker warnings.

The patch 0c493b5cf16e: "NFS: Convert buffered writes to use folios" from Jan 19, 2023, leads to the following Smatch complaint:

fs/nfs/write.c:793 nfs_inode_remove_request()
warn: variable dereferenced before check 'folio' (see line 790)

fs/nfs/write.c
789 struct folio *folio = nfs_page_to_folio(req->wb_head);

   790			struct address_space *mapping = folio_file_mapping(folio);
                                                                           ^^^^^

Patch adds dereference

791
792 spin_lock(&mapping->private_lock);

   793			if (likely(folio && !folio_test_swapcache(folio))) {
                                   ^^^^^

Patch adds a check (too late).

   794				folio->private = NULL;
   795				folio_clear_private(folio);

regards,
dan carpenter