[tytso-ext4:dev 43/47] fs/ext4/inode.c:573:49-51: WARNING !A || A && B is equivalent to !A || B

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
head:   e4e129b9e3d37b21d78a5a6617c6987dafa9600d
commit: 2e7bad830aa9995dbc11577b8ee5090bc06b1b7b [43/47] ext4: Add support for EXT4_GET_BLOCKS_QUERY_LEAF_BLOCKS
config: alpha-randconfig-r062-20250519 (https://download.01.org/0day-ci/archive/20250519/202505191524.auftmOwK-lkp@xxxxxxxxx/config)
compiler: alpha-linux-gcc (GCC) 11.5.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505191524.auftmOwK-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> fs/ext4/inode.c:573:49-51: WARNING !A || A && B is equivalent to !A || B

vim +573 fs/ext4/inode.c

   540	
   541	static int ext4_map_query_blocks(handle_t *handle, struct inode *inode,
   542					 struct ext4_map_blocks *map, int flags)
   543	{
   544		unsigned int status;
   545		int retval;
   546		unsigned int orig_mlen = map->m_len;
   547		unsigned int query_flags = flags & EXT4_GET_BLOCKS_QUERY_LAST_IN_LEAF;
   548	
   549		flags &= EXT4_EX_FILTER;
   550		if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
   551			retval = ext4_ext_map_blocks(handle, inode, map,
   552						     flags | query_flags);
   553		else
   554			retval = ext4_ind_map_blocks(handle, inode, map, flags);
   555	
   556		if (retval <= 0)
   557			return retval;
   558	
   559		if (unlikely(retval != map->m_len)) {
   560			ext4_warning(inode->i_sb,
   561				     "ES len assertion failed for inode "
   562				     "%lu: retval %d != map->m_len %d",
   563				     inode->i_ino, retval, map->m_len);
   564			WARN_ON(1);
   565		}
   566	
   567		/*
   568		 * No need to query next in leaf:
   569		 * - if returned extent is not last in leaf or
   570		 * - if the last in leaf is the full requested range
   571		 */
   572		if (!(map->m_flags & EXT4_MAP_QUERY_LAST_IN_LEAF) ||
 > 573				((map->m_flags & EXT4_MAP_QUERY_LAST_IN_LEAF) &&
   574				 (map->m_len == orig_mlen))) {
   575			status = map->m_flags & EXT4_MAP_UNWRITTEN ?
   576					EXTENT_STATUS_UNWRITTEN : EXTENT_STATUS_WRITTEN;
   577			ext4_es_insert_extent(inode, map->m_lblk, map->m_len,
   578					      map->m_pblk, status, false);
   579			return retval;
   580		}
   581	
   582		return ext4_map_query_blocks_next_in_leaf(handle, inode, map,
   583							  orig_mlen);
   584	}
   585	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux