[bug report] NFS: Convert buffered writes to use folios
From: Dan Carpenter <hidden>
Date: 2023-02-23 04:57:12
From: Dan Carpenter <hidden>
Date: 2023-02-23 04:57:12
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