Re: [PATCH] fs: Fix page cache inconsistency when mixing buffered and AIO DIO

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

 



On Fri, Jul 14, 2017 at 06:41:52PM +0800, kbuild test robot wrote:
> Hi Lukas,
> 
> [auto build test WARNING on linus/master]
> [also build test WARNING on v4.12 next-20170713]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> 
> url:    https://github.com/0day-ci/linux/commits/Lukas-Czerner/fs-Fix-page-cache-inconsistency-when-mixing-buffered-and-AIO-DIO/20170714-181130
> config: x86_64-randconfig-x010-201728 (attached as .config)
> compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=x86_64 
> 
> Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
> http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings
> 
> All warnings (new ones prefixed by >>):
> 
>    fs/iomap.c: In function 'iomap_dio_complete':
> >> fs/iomap.c:629:25: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
>         (offset + dio->size + ret - 1) >> PAGE_SHIFT);
>          ~~~~~~~~~~~~~~~~~~~^~~~~

Oops, right, this is obviously wrong.

Thanks!
-Lukas

> 
> vim +/ret +629 fs/iomap.c
> 
>    618	
>    619	static ssize_t iomap_dio_complete(struct iomap_dio *dio)
>    620	{
>    621		struct kiocb *iocb = dio->iocb;
>    622		loff_t offset = iocb->ki_pos;
>    623		struct inode *inode = file_inode(iocb->ki_filp);
>    624		ssize_t ret;
>    625	
>    626		if ((dio->flags & IOMAP_DIO_WRITE) && inode->i_mapping->nrpages)
>    627			invalidate_inode_pages2_range(inode->i_mapping,
>    628					offset >> PAGE_SHIFT,
>  > 629					(offset + dio->size + ret - 1) >> PAGE_SHIFT);
>    630	
>    631		if (dio->end_io) {
>    632			ret = dio->end_io(iocb,
>    633					dio->error ? dio->error : dio->size,
>    634					dio->flags);
>    635		} else {
>    636			ret = dio->error;
>    637		}
>    638	
>    639		if (likely(!ret)) {
>    640			ret = dio->size;
>    641			/* check for short read */
>    642			if (iocb->ki_pos + ret > dio->i_size &&
>    643			    !(dio->flags & IOMAP_DIO_WRITE))
>    644				ret = dio->i_size - iocb->ki_pos;
>    645			iocb->ki_pos += ret;
>    646		}
>    647	
>    648		inode_dio_end(file_inode(iocb->ki_filp));
>    649		kfree(dio);
>    650	
>    651		return ret;
>    652	}
>    653	
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation





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