Coverity: ext4_iomap_alloc(): Integer handling issues

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

 



Hello!

This is an experimental automated report about issues detected by Coverity
from a scan of next-20191108 as part of the linux-next weekly scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by recent commits:

378f32bab371 ("ext4: introduce direct I/O write using iomap infrastructure")

Coverity reported the following:

*** CID 1487841:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
/fs/ext4/inode.c: 3388 in ext4_iomap_alloc()
3382     	/*
3383     	 * We use i_size instead of i_disksize here because delalloc writeback
3384     	 * can complete at any point during the I/O and subsequently push the
3385     	 * i_disksize out to i_size. This could be beyond where direct I/O is
3386     	 * happening and thus expose allocated blocks to direct I/O reads.
3387     	 */
vvv     CID 1487841:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
vvv     Potentially overflowing expression "1 << blkbits" with type "int" (32 bits, signed) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "loff_t" (64 bits, signed).
3388     	else if ((map->m_lblk * (1 << blkbits)) >= i_size_read(inode))
3389     		m_flags = EXT4_GET_BLOCKS_CREATE;
3390     	else if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
3391     		m_flags = EXT4_GET_BLOCKS_IO_CREATE_EXT;
3392
3393     	ret = ext4_map_blocks(handle, inode, map, m_flags);

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <keescook+coverity-bot@xxxxxxxxxxxx>
Addresses-Coverity-ID: 1487841 ("Integer handling issues")
Fixes: 378f32bab371 ("ext4: introduce direct I/O write using iomap infrastructure")


Thanks for your attention!

-- 
Coverity-bot



[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux