[bug report] buffer: convert block_truncate_page() to use a folio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Matthew Wilcox (Oracle),

The patch dd69ce3382a2: "buffer: convert block_truncate_page() to use
a folio" from Jun 12, 2023, leads to the following Smatch static
checker warning:

fs/buffer.c:1066 grow_dev_page() error: 'folio' dereferencing possible ERR_PTR()

This one seems like a false positive,  If you call __filemap_get_folio()
with __GFP_NOFAIL then it only returns valid pointers, right?

fs/buffer.c:2689 block_truncate_page() warn: 'folio' is an error pointer or valid
fs/buffer.c:2692 block_truncate_page() error: 'folio' dereferencing possible ERR_PTR()

fs/buffer.c
    2679         length = from & (blocksize - 1);
    2680 
    2681         /* Block boundary? Nothing to do */
    2682         if (!length)
    2683                 return 0;
    2684 
    2685         length = blocksize - length;
    2686         iblock = (sector_t)index << (PAGE_SHIFT - inode->i_blkbits);
    2687         
    2688         folio = filemap_grab_folio(mapping, index);
--> 2689         if (!folio)

This should be IS_ERR(). 

    2690                 return -ENOMEM;
    2691 
    2692         bh = folio_buffers(folio);
                                    ^^^^^
Dereferenced.

    2693         if (!bh) {
    2694                 folio_create_empty_buffers(folio, blocksize, 0);
    2695                 bh = folio_buffers(folio);
    2696         }
    2697 
    2698         /* Find the buffer that contains "offset" */

regards,
dan carpenter



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux