Hi George, kernel test robot noticed the following build warnings: [auto build test WARNING on brauner-vfs/vfs.all] [also build test WARNING on linus/master v7.0-rc6 next-20260331] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/George-Anthony-Vernon/hfs-Validate-CNIDs-in-hfs_read_inode/20260330-162217 base: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git vfs.all patch link: https://lore.kernel.org/r/20260329205949.701267-1-contact%40gvernon.com patch subject: [PATCH v5] hfs: Validate CNIDs in hfs_read_inode config: hexagon-allmodconfig compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): 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 | Closes: https://lore.kernel.org/oe-kbuild-all/202604020046.baBKWIUX-lkp@intel.com/ All warnings (new ones prefixed by >>): >> fs/hfs/inode.c:435:44: warning: format specifies type 'unsigned long' but the argument has type 'u32' (aka 'unsigned int') [-Wformat] 435 | pr_warn("Invalid inode with cnid %lu\n", cnid); | ~~~ ^~~~ | %u include/linux/printk.h:564:37: note: expanded from macro 'pr_warn' 564 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) | ~~~ ^~~~~~~~~~~ include/linux/printk.h:511:60: note: expanded from macro 'printk' 511 | #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) | ~~~ ^~~~~~~~~~~ include/linux/printk.h:483:19: note: expanded from macro 'printk_index_wrap' 483 | _p_func(_fmt, ##__VA_ARGS__); \ | ~~~~ ^~~~~~~~~~~ 1 warning generated. vim +435 fs/hfs/inode.c 367 368 /* 369 * hfs_read_inode 370 */ 371 static int hfs_read_inode(struct inode *inode, void *data) 372 { 373 struct hfs_iget_data *idata = data; 374 struct hfs_sb_info *hsb = HFS_SB(inode->i_sb); 375 hfs_cat_rec *rec; 376 u32 cnid; 377 378 HFS_I(inode)->flags = 0; 379 HFS_I(inode)->rsrc_inode = NULL; 380 mutex_init(&HFS_I(inode)->extents_lock); 381 INIT_LIST_HEAD(&HFS_I(inode)->open_dir_list); 382 spin_lock_init(&HFS_I(inode)->open_dir_lock); 383 384 /* Initialize the inode */ 385 inode->i_uid = hsb->s_uid; 386 inode->i_gid = hsb->s_gid; 387 set_nlink(inode, 1); 388 389 if (idata->key) 390 HFS_I(inode)->cat_key = *idata->key; 391 else 392 HFS_I(inode)->flags |= HFS_FLG_RSRC; 393 HFS_I(inode)->tz_secondswest = sys_tz.tz_minuteswest * 60; 394 395 rec = idata->rec; 396 switch (rec->type) { 397 case HFS_CDR_FIL: 398 cnid = be32_to_cpu(rec->file.FlNum); 399 if (!is_valid_catalog_record(cnid, rec->type)) 400 goto make_bad_inode; 401 if (!HFS_IS_RSRC(inode)) { 402 hfs_inode_read_fork(inode, rec->file.ExtRec, rec->file.LgLen, 403 rec->file.PyLen, be16_to_cpu(rec->file.ClpSize)); 404 } else { 405 hfs_inode_read_fork(inode, rec->file.RExtRec, rec->file.RLgLen, 406 rec->file.RPyLen, be16_to_cpu(rec->file.ClpSize)); 407 } 408 409 inode->i_ino = cnid; 410 inode->i_mode = S_IRUGO | S_IXUGO; 411 if (!(rec->file.Flags & HFS_FIL_LOCK)) 412 inode->i_mode |= S_IWUGO; 413 inode->i_mode &= ~hsb->s_file_umask; 414 inode->i_mode |= S_IFREG; 415 inode_set_mtime_to_ts(inode, 416 inode_set_atime_to_ts(inode, inode_set_ctime_to_ts(inode, hfs_m_to_utime(rec->file.MdDat)))); 417 inode->i_op = &hfs_file_inode_operations; 418 inode->i_fop = &hfs_file_operations; 419 inode->i_mapping->a_ops = &hfs_aops; 420 break; 421 case HFS_CDR_DIR: 422 cnid = be32_to_cpu(rec->dir.DirID); 423 if (!is_valid_catalog_record(cnid, rec->type)) 424 goto make_bad_inode; 425 inode->i_ino = cnid; 426 inode->i_size = be16_to_cpu(rec->dir.Val) + 2; 427 HFS_I(inode)->fs_blocks = 0; 428 inode->i_mode = S_IFDIR | (S_IRWXUGO & ~hsb->s_dir_umask); 429 inode_set_mtime_to_ts(inode, 430 inode_set_atime_to_ts(inode, inode_set_ctime_to_ts(inode, hfs_m_to_utime(rec->dir.MdDat)))); 431 inode->i_op = &hfs_dir_inode_operations; 432 inode->i_fop = &hfs_dir_operations; 433 break; 434 make_bad_inode: > 435 pr_warn("Invalid inode with cnid %lu\n", cnid); 436 pr_warn("Volume is probably corrupted, try performing fsck.\n"); 437 fallthrough; 438 default: 439 make_bad_inode(inode); 440 break; 441 } 442 return 0; 443 } 444 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki