Re: [PATCH 4/4] ubifs: Convert do_writepage() to take a folio

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

 



On Tue, Jun 06, 2023 at 08:13:55AM +0200, Richard Weinberger wrote:
> Matthew,
> 
> ----- Ursprüngliche Mail -----
> > Von: "Matthew Wilcox" <willy@xxxxxxxxxxxxx>
> > len is folio_size(), which is not 0.
> > 
> >        len = offset_in_folio(folio, i_size);
> 
> offset_in_folio(folio, i_size) can give 0.

Oh!  There is a bug, because it shouldn't get here!

        /* Is the folio fully inside i_size? */
        if (folio_pos(folio) + len < i_size) {

should be:

        /* Is the folio fully inside i_size? */
        if (folio_pos(folio) + len <= i_size) {

right?  Consider a file with i_size 4096.  its single-page folio will
have a pos of 0 and a length of 4096.  so it should be written back by
the first call to do_writepage(), not the case where the folio straddles
i_size.




[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