[linux-next:master 11033/12060] fs/bcachefs/sb-clean.c:286:55: sparse: sparse: cast to restricted __le16

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   e7b4ef8fffaca247809337bb78daceb406659f2d
commit: f39055220f6f98a180e3503fe05bbf9921c425c8 [11033/12060] bcachefs: Add missing validation for superblock section clean
config: x86_64-randconfig-121-20240508 (https://download.01.org/0day-ci/archive/20240508/202405082039.0al6Fpg8-lkp@xxxxxxxxx/config)
compiler: clang version 18.1.4 (https://github.com/llvm/llvm-project e6c3289804a67ea0bb6a86fadbe454dd93b8d855)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240508/202405082039.0al6Fpg8-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405082039.0al6Fpg8-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
   fs/bcachefs/sb-clean.c: note: in included file:
   fs/bcachefs/bcachefs.h:1027:9: sparse: sparse: array of flexible structures
   fs/bcachefs/sb-clean.c: note: in included file (through fs/bcachefs/bcachefs.h):
   fs/bcachefs/bcachefs_format.h:800:38: sparse: sparse: array of flexible structures
   fs/bcachefs/bcachefs_format.h:1459:38: sparse: sparse: array of flexible structures
>> fs/bcachefs/sb-clean.c:286:55: sparse: sparse: cast to restricted __le16

vim +286 fs/bcachefs/sb-clean.c

   268	
   269	static int bch2_sb_clean_validate(struct bch_sb *sb,
   270					  struct bch_sb_field *f,
   271					  struct printbuf *err)
   272	{
   273		struct bch_sb_field_clean *clean = field_to_type(f, clean);
   274	
   275		if (vstruct_bytes(&clean->field) < sizeof(*clean)) {
   276			prt_printf(err, "wrong size (got %zu should be %zu)",
   277			       vstruct_bytes(&clean->field), sizeof(*clean));
   278			return -BCH_ERR_invalid_sb_clean;
   279		}
   280	
   281		for (struct jset_entry *entry = clean->start;
   282		     entry != vstruct_end(&clean->field);
   283		     entry = vstruct_next(entry)) {
   284			if ((void *) vstruct_next(entry) > vstruct_end(&clean->field)) {
   285				prt_str(err, "entry type ");
 > 286				bch2_prt_jset_entry_type(err, le16_to_cpu(entry->type));
   287				prt_str(err, " overruns end of section");
   288				return -BCH_ERR_invalid_sb_clean;
   289			}
   290		}
   291	
   292		return 0;
   293	}
   294	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux