Re: [bug report] iomap: write iomap validity checks

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

 



On Fri, Jan 20, 2023 at 04:16:55PM +0000, Matthew Wilcox wrote:
> On Fri, Jan 20, 2023 at 04:47:04PM +0300, Dan Carpenter wrote:
> > Hello Dave Chinner,
> > 
> > The patch d7b64041164c: "iomap: write iomap validity checks" from Nov
> > 29, 2022, leads to the following Smatch static checker warning:
> > 
> > 	fs/iomap/buffered-io.c:829 iomap_write_iter()
> > 	error: uninitialized symbol 'folio'.
> > 
> > fs/iomap/buffered-io.c
> >     818                 if (unlikely(fault_in_iov_iter_readable(i, bytes) == bytes)) {
> >     819                         status = -EFAULT;
> >     820                         break;
> >     821                 }
> >     822 
> >     823                 status = iomap_write_begin(iter, pos, bytes, &folio);
> >                                                                      ^^^^^^^
> > The iomap_write_begin() function can succeed without initializing
> > *foliop.  It's next to the big comment.
> 
> Yes, but if it does, it sets IOMAP_F_STALE
> 
> >     824                 if (unlikely(status))
> >     825                         break;
> >     826                 if (iter->iomap.flags & IOMAP_F_STALE)
> >     827                         break;
> 
> so it breaks out here.  Maybe we should return an errno from
> iomap_write_begin() to make life easier for the static checking tools?
> 

Thanks for taking a look at this.  I say just leave it as-is.

I know how to modify Smatch to handle this correctly, but it's quite a
lot of typing involved.

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