[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-nfs
Subject:    [bug report] NFS: Convert buffered writes to use folios
From:       Dan Carpenter <error27 () gmail ! com>
Date:       2023-02-22 14:02:18
Message-ID: Y/YgahwOk4DL217a () kili
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic