Re: [PATCH 3/4] exfat: add boot region verification
From: kbuild test robot
Date: Fri May 29 2020 - 12:51:47 EST
Hi Tetsuhiro,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on next-20200519]
[cannot apply to linus/master v5.7-rc7 v5.7-rc6 v5.7-rc5 v5.7-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Tetsuhiro-Kohada/exfat-redefine-PBR-as-boot_sector/20200525-195329
base: fb57b1fabcb28f358901b2df90abd2b48abc1ca8
config: c6x-randconfig-s032-20200529 (attached as .config)
compiler: c6x-elf-gcc (GCC) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-243-gc100a7ab-dirty
# save the attached .config to linux build tree
make W=1 C=1 ARCH=c6x CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
>> fs/exfat/super.c:485:29: sparse: sparse: cast to restricted __le32
>> fs/exfat/super.c:485:29: sparse: sparse: cast to restricted __le32
>> fs/exfat/super.c:485:29: sparse: sparse: cast to restricted __le32
>> fs/exfat/super.c:485:29: sparse: sparse: cast to restricted __le32
>> fs/exfat/super.c:485:29: sparse: sparse: cast to restricted __le32
>> fs/exfat/super.c:485:29: sparse: sparse: cast to restricted __le32
fs/exfat/super.c:504:21: sparse: sparse: cast to restricted __le32
fs/exfat/super.c:504:21: sparse: sparse: cast to restricted __le32
fs/exfat/super.c:504:21: sparse: sparse: cast to restricted __le32
fs/exfat/super.c:504:21: sparse: sparse: cast to restricted __le32
fs/exfat/super.c:504:21: sparse: sparse: cast to restricted __le32
fs/exfat/super.c:504:21: sparse: sparse: cast to restricted __le32
vim +485 fs/exfat/super.c
469
470 static int exfat_verify_boot_region(struct super_block *sb)
471 {
472 struct buffer_head *bh = NULL;
473 u32 chksum = 0, *p_sig, *p_chksum;
474 int sn, i;
475
476 /* read boot sector sub-regions */
477 for (sn = 0; sn < 11; sn++) {
478 bh = sb_bread(sb, sn);
479 if (!bh)
480 return -EIO;
481
482 if (sn != 0 && sn <= 8) {
483 /* extended boot sector sub-regions */
484 p_sig = (u32 *)&bh->b_data[sb->s_blocksize - 4];
> 485 if (le32_to_cpu(*p_sig) != EXBOOT_SIGNATURE) {
486 exfat_err(sb, "no exboot-signature");
487 brelse(bh);
488 return -EINVAL;
489 }
490 }
491
492 chksum = exfat_calc_chksum32(bh->b_data, sb->s_blocksize,
493 chksum, sn ? CS_DEFAULT : CS_BOOT_SECTOR);
494 brelse(bh);
495 }
496
497 /* boot checksum sub-regions */
498 bh = sb_bread(sb, sn);
499 if (!bh)
500 return -EIO;
501
502 for (i = 0; i < sb->s_blocksize; i += sizeof(u32)) {
503 p_chksum = (u32 *)&bh->b_data[i];
504 if (le32_to_cpu(*p_chksum) != chksum) {
505 exfat_err(sb, "mismatch checksum");
506 brelse(bh);
507 return -EINVAL;
508 }
509 }
510 brelse(bh);
511 return 0;
512 }
513
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip