Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* [chao:wip 18/20] fs/f2fs/inode.c:319:6: warning: format specifies type 'unsigned long' but the argument has type 'unsigned int'
@ 2024-12-15 17:40 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-12-15 17:40 UTC (permalink / raw)
  To: Chao Yu, Chao Yu; +Cc: llvm, oe-kbuild-all, Chao Yu, Chao Yu

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/chao/linux.git wip
head:   14a0b37677c60e56234bfdca48f2893895e751f3
commit: 03605b8f85a900083d1f7f2d3d19fcd16cbcdd96 [18/20] f2fs: fix to do sanity check correctly on i_inline_xattr_size
config: arm-randconfig-001-20241215 (https://download.01.org/0day-ci/archive/20241216/202412160100.oeyMjZmI-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 2dc22615fd46ab2566d0f26d5ba234ab12dc4bf8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241216/202412160100.oeyMjZmI-lkp@intel.com/reproduce)

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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412160100.oeyMjZmI-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from fs/f2fs/inode.c:9:
   In file included from include/linux/f2fs_fs.h:11:
   In file included from include/linux/pagemap.h:8:
   In file included from include/linux/mm.h:2223:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> fs/f2fs/inode.c:319:6: warning: format specifies type 'unsigned long' but the argument has type 'unsigned int' [-Wformat]
     317 |                 f2fs_warn(sbi, "%s: inode (ino=%lx) has corrupted i_inline_xattr_size: %d, min: %lu, max: %lu",
         |                                                                                                 ~~~
         |                                                                                                 %u
     318 |                           __func__, inode->i_ino, fi->i_inline_xattr_size,
     319 |                           MIN_INLINE_XATTR_SIZE, MAX_INLINE_XATTR_SIZE);
         |                           ^~~~~~~~~~~~~~~~~~~~~
   fs/f2fs/f2fs.h:1855:46: note: expanded from macro 'f2fs_warn'
    1855 |         f2fs_printk(sbi, false, KERN_WARNING fmt, ##__VA_ARGS__)
         |                                              ~~~    ^~~~~~~~~~~
   fs/f2fs/xattr.h:86:31: note: expanded from macro 'MIN_INLINE_XATTR_SIZE'
      86 | #define MIN_INLINE_XATTR_SIZE (sizeof(struct f2fs_xattr_header) / sizeof(__le32))
         |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   2 warnings generated.


vim +319 fs/f2fs/inode.c

   269	
   270	static bool sanity_check_inode(struct inode *inode, struct page *node_page)
   271	{
   272		struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
   273		struct f2fs_inode_info *fi = F2FS_I(inode);
   274		struct f2fs_inode *ri = F2FS_INODE(node_page);
   275		unsigned long long iblocks;
   276	
   277		iblocks = le64_to_cpu(F2FS_INODE(node_page)->i_blocks);
   278		if (!iblocks) {
   279			f2fs_warn(sbi, "%s: corrupted inode i_blocks i_ino=%lx iblocks=%llu, run fsck to fix.",
   280				  __func__, inode->i_ino, iblocks);
   281			return false;
   282		}
   283	
   284		if (ino_of_node(node_page) != nid_of_node(node_page)) {
   285			f2fs_warn(sbi, "%s: corrupted inode footer i_ino=%lx, ino,nid: [%u, %u] run fsck to fix.",
   286				  __func__, inode->i_ino,
   287				  ino_of_node(node_page), nid_of_node(node_page));
   288			return false;
   289		}
   290	
   291		if (f2fs_has_extra_attr(inode)) {
   292			if (!f2fs_sb_has_extra_attr(sbi)) {
   293				f2fs_warn(sbi, "%s: inode (ino=%lx) is with extra_attr, but extra_attr feature is off",
   294					  __func__, inode->i_ino);
   295				return false;
   296			}
   297			if (fi->i_extra_isize > F2FS_TOTAL_EXTRA_ATTR_SIZE ||
   298				fi->i_extra_isize < F2FS_MIN_EXTRA_ATTR_SIZE ||
   299				fi->i_extra_isize % sizeof(__le32)) {
   300				f2fs_warn(sbi, "%s: inode (ino=%lx) has corrupted i_extra_isize: %d, max: %zu",
   301					  __func__, inode->i_ino, fi->i_extra_isize,
   302					  F2FS_TOTAL_EXTRA_ATTR_SIZE);
   303				return false;
   304			}
   305			if (f2fs_sb_has_compression(sbi) &&
   306				fi->i_flags & F2FS_COMPR_FL &&
   307				F2FS_FITS_IN_INODE(ri, fi->i_extra_isize,
   308							i_compress_flag)) {
   309				if (!sanity_check_compress_inode(inode, ri))
   310					return false;
   311			}
   312		}
   313	
   314		if (f2fs_sb_has_flexible_inline_xattr(sbi) &&
   315			(fi->i_inline_xattr_size < MIN_INLINE_XATTR_SIZE ||
   316			fi->i_inline_xattr_size > MAX_INLINE_XATTR_SIZE)) {
   317			f2fs_warn(sbi, "%s: inode (ino=%lx) has corrupted i_inline_xattr_size: %d, min: %lu, max: %lu",
   318				  __func__, inode->i_ino, fi->i_inline_xattr_size,
 > 319				  MIN_INLINE_XATTR_SIZE, MAX_INLINE_XATTR_SIZE);
   320			return false;
   321		}
   322	
   323		if (!f2fs_sb_has_extra_attr(sbi)) {
   324			if (f2fs_sb_has_project_quota(sbi)) {
   325				f2fs_warn(sbi, "%s: corrupted inode ino=%lx, wrong feature flag: %u, run fsck to fix.",
   326					  __func__, inode->i_ino, F2FS_FEATURE_PRJQUOTA);
   327				return false;
   328			}
   329			if (f2fs_sb_has_inode_chksum(sbi)) {
   330				f2fs_warn(sbi, "%s: corrupted inode ino=%lx, wrong feature flag: %u, run fsck to fix.",
   331					  __func__, inode->i_ino, F2FS_FEATURE_INODE_CHKSUM);
   332				return false;
   333			}
   334			if (f2fs_sb_has_flexible_inline_xattr(sbi)) {
   335				f2fs_warn(sbi, "%s: corrupted inode ino=%lx, wrong feature flag: %u, run fsck to fix.",
   336					  __func__, inode->i_ino, F2FS_FEATURE_FLEXIBLE_INLINE_XATTR);
   337				return false;
   338			}
   339			if (f2fs_sb_has_inode_crtime(sbi)) {
   340				f2fs_warn(sbi, "%s: corrupted inode ino=%lx, wrong feature flag: %u, run fsck to fix.",
   341					  __func__, inode->i_ino, F2FS_FEATURE_INODE_CRTIME);
   342				return false;
   343			}
   344			if (f2fs_sb_has_compression(sbi)) {
   345				f2fs_warn(sbi, "%s: corrupted inode ino=%lx, wrong feature flag: %u, run fsck to fix.",
   346					  __func__, inode->i_ino, F2FS_FEATURE_COMPRESSION);
   347				return false;
   348			}
   349		}
   350	
   351		if (f2fs_sanity_check_inline_data(inode, node_page)) {
   352			f2fs_warn(sbi, "%s: inode (ino=%lx, mode=%u) should not have inline_data, run fsck to fix",
   353				  __func__, inode->i_ino, inode->i_mode);
   354			return false;
   355		}
   356	
   357		if (f2fs_has_inline_dentry(inode) && !S_ISDIR(inode->i_mode)) {
   358			f2fs_warn(sbi, "%s: inode (ino=%lx, mode=%u) should not have inline_dentry, run fsck to fix",
   359				  __func__, inode->i_ino, inode->i_mode);
   360			return false;
   361		}
   362	
   363		if ((fi->i_flags & F2FS_CASEFOLD_FL) && !f2fs_sb_has_casefold(sbi)) {
   364			f2fs_warn(sbi, "%s: inode (ino=%lx) has casefold flag, but casefold feature is off",
   365				  __func__, inode->i_ino);
   366			return false;
   367		}
   368	
   369		if (fi->i_xattr_nid && f2fs_check_nid_range(sbi, fi->i_xattr_nid)) {
   370			f2fs_warn(sbi, "%s: inode (ino=%lx) has corrupted i_xattr_nid: %u, run fsck to fix.",
   371				  __func__, inode->i_ino, fi->i_xattr_nid);
   372			return false;
   373		}
   374	
   375		if (IS_DEVICE_ALIASING(inode)) {
   376			if (!f2fs_sb_has_device_alias(sbi)) {
   377				f2fs_warn(sbi, "%s: inode (ino=%lx) has device alias flag, but the feature is off",
   378					  __func__, inode->i_ino);
   379				return false;
   380			}
   381			if (!f2fs_is_pinned_file(inode)) {
   382				f2fs_warn(sbi, "%s: inode (ino=%lx) has device alias flag, but is not pinned",
   383					  __func__, inode->i_ino);
   384				return false;
   385			}
   386		}
   387	
   388		return true;
   389	}
   390	

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-12-15 17:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-15 17:40 [chao:wip 18/20] fs/f2fs/inode.c:319:6: warning: format specifies type 'unsigned long' but the argument has type 'unsigned int' kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox