Re: [PATCH] fix array index out of bound exception
From: kernel test robot
Date: Wed Aug 11 2021 - 12:39:27 EST
Hi SULAIMAN",
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.14-rc5 next-20210811]
[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]
url: https://github.com/0day-ci/linux/commits/F-A-SULAIMAN/fix-array-index-out-of-bound-exception/20210811-211453
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 761c6d7ec820f123b931e7b8ef7ec7c8564e450f
config: x86_64-randconfig-c001-20210810 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d39ebdae674c8efc84ebe8dc32716ec353220530)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/3c70bc4978e0cb74c7ba5189c093ecccf4564925
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review F-A-SULAIMAN/fix-array-index-out-of-bound-exception/20210811-211453
git checkout 3c70bc4978e0cb74c7ba5189c093ecccf4564925
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
>> fs/udf/super.c:2524:12: warning: cast to smaller integer type '__le32' (aka 'unsigned int') from '__le32 *' (aka 'unsigned int *') [-Wpointer-to-int-cast]
accum = le32_to_cpu(
^~~~~~~~~~~~
include/linux/byteorder/generic.h:89:21: note: expanded from macro 'le32_to_cpu'
#define le32_to_cpu __le32_to_cpu
^
include/uapi/linux/byteorder/little_endian.h:34:42: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^~~~~~~~~~~
1 warning generated.
vim +2524 fs/udf/super.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 2499
cb00ea3528eb3c Cyrill Gorcunov 2007-07-19 2500 static unsigned int udf_count_free(struct super_block *sb)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2501 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2502 unsigned int accum = 0;
a4a8b99ec819ca Jan Kara 2020-01-07 2503 struct udf_sb_info *sbi = UDF_SB(sb);
6c79e987d629cb Marcin Slusarz 2008-02-08 2504 struct udf_part_map *map;
a4a8b99ec819ca Jan Kara 2020-01-07 2505 unsigned int part = sbi->s_partition;
a4a8b99ec819ca Jan Kara 2020-01-07 2506 int ptype = sbi->s_partmaps[part].s_partition_type;
a4a8b99ec819ca Jan Kara 2020-01-07 2507
a4a8b99ec819ca Jan Kara 2020-01-07 2508 if (ptype == UDF_METADATA_MAP25) {
a4a8b99ec819ca Jan Kara 2020-01-07 2509 part = sbi->s_partmaps[part].s_type_specific.s_metadata.
a4a8b99ec819ca Jan Kara 2020-01-07 2510 s_phys_partition_ref;
a4a8b99ec819ca Jan Kara 2020-01-07 2511 } else if (ptype == UDF_VIRTUAL_MAP15 || ptype == UDF_VIRTUAL_MAP20) {
a4a8b99ec819ca Jan Kara 2020-01-07 2512 /*
a4a8b99ec819ca Jan Kara 2020-01-07 2513 * Filesystems with VAT are append-only and we cannot write to
a4a8b99ec819ca Jan Kara 2020-01-07 2514 * them. Let's just report 0 here.
a4a8b99ec819ca Jan Kara 2020-01-07 2515 */
a4a8b99ec819ca Jan Kara 2020-01-07 2516 return 0;
a4a8b99ec819ca Jan Kara 2020-01-07 2517 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2518
6c79e987d629cb Marcin Slusarz 2008-02-08 2519 if (sbi->s_lvid_bh) {
4b11111aba6c80 Marcin Slusarz 2008-02-08 2520 struct logicalVolIntegrityDesc *lvid =
4b11111aba6c80 Marcin Slusarz 2008-02-08 2521 (struct logicalVolIntegrityDesc *)
4b11111aba6c80 Marcin Slusarz 2008-02-08 2522 sbi->s_lvid_bh->b_data;
a4a8b99ec819ca Jan Kara 2020-01-07 2523 if (le32_to_cpu(lvid->numOfPartitions) > part) {
4b11111aba6c80 Marcin Slusarz 2008-02-08 @2524 accum = le32_to_cpu(
3c70bc4978e0cb F.A.Sulaiman 2021-08-11 2525 (lvid->freeSpaceTable + part));
^1da177e4c3f41 Linus Torvalds 2005-04-16 2526 if (accum == 0xFFFFFFFF)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2527 accum = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2528 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2529 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2530
^1da177e4c3f41 Linus Torvalds 2005-04-16 2531 if (accum)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2532 return accum;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2533
a4a8b99ec819ca Jan Kara 2020-01-07 2534 map = &sbi->s_partmaps[part];
6c79e987d629cb Marcin Slusarz 2008-02-08 2535 if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) {
28de7948a89676 Cyrill Gorcunov 2007-07-21 2536 accum += udf_count_free_bitmap(sb,
6c79e987d629cb Marcin Slusarz 2008-02-08 2537 map->s_uspace.s_bitmap);
28de7948a89676 Cyrill Gorcunov 2007-07-21 2538 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2539 if (accum)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2540 return accum;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2541
6c79e987d629cb Marcin Slusarz 2008-02-08 2542 if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) {
28de7948a89676 Cyrill Gorcunov 2007-07-21 2543 accum += udf_count_free_table(sb,
6c79e987d629cb Marcin Slusarz 2008-02-08 2544 map->s_uspace.s_table);
28de7948a89676 Cyrill Gorcunov 2007-07-21 2545 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2546 return accum;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2547 }
54bb60d53114b8 Fabian Frederick 2017-01-06 2548
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip