fs/ext4/super.c:5656 ext4_fill_super() error: we previously assumed 'sbi' could be null (see line 5648)
From: Dan Carpenter
Date: Wed Jan 19 2022 - 00:22:40 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fe81ba137ebcc7f236780996a0b375732c07e85c
commit: cebe85d570cf84804e848332d6721bc9e5300e07 ext4: switch to the new mount api
config: s390-randconfig-m031-20220117 (https://download.01.org/0day-ci/archive/20220118/202201182249.eXYOFfs9-lkp@xxxxxxxxx/config)
compiler: s390-linux-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
New smatch warnings:
fs/ext4/super.c:5656 ext4_fill_super() error: we previously assumed 'sbi' could be null (see line 5648)
Old smatch warnings:
fs/ext4/super.c:4165 ext4_register_li_request() error: we previously assumed 'ext4_li_info' could be null (see line 4147)
vim +/sbi +5656 fs/ext4/super.c
cebe85d570cf84 Lukas Czerner 2021-10-27 5640 static int ext4_fill_super(struct super_block *sb, struct fs_context *fc)
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5641 {
cebe85d570cf84 Lukas Czerner 2021-10-27 5642 struct ext4_fs_context *ctx = fc->fs_private;
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5643 struct ext4_sb_info *sbi;
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5644 const char *descr;
cebe85d570cf84 Lukas Czerner 2021-10-27 5645 int ret;
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5646
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5647 sbi = ext4_alloc_sbi(sb);
cebe85d570cf84 Lukas Czerner 2021-10-27 @5648 if (!sbi)
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5649 ret = -ENOMEM;
Presumably this should be "return -ENOMEM;"
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5650
cebe85d570cf84 Lukas Czerner 2021-10-27 5651 fc->s_fs_info = sbi;
cebe85d570cf84 Lukas Czerner 2021-10-27 5652
cebe85d570cf84 Lukas Czerner 2021-10-27 5653 /* Cleanup superblock name */
cebe85d570cf84 Lukas Czerner 2021-10-27 5654 strreplace(sb->s_id, '/', '!');
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5655
7edfd85b1ffd36 Lukas Czerner 2021-10-27 @5656 sbi->s_sb_block = 1; /* Default super block location */
^^^^^
cebe85d570cf84 Lukas Czerner 2021-10-27 5657 if (ctx->spec & EXT4_SPEC_s_sb_block)
cebe85d570cf84 Lukas Czerner 2021-10-27 5658 sbi->s_sb_block = ctx->s_sb_block;
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5659
cebe85d570cf84 Lukas Czerner 2021-10-27 5660 ret = __ext4_fill_super(fc, sb, fc->sb_flags & SB_SILENT);
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5661 if (ret < 0)
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5662 goto free_sbi;
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5663
cebe85d570cf84 Lukas Czerner 2021-10-27 5664 if (sbi->s_journal) {
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5665 if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5666 descr = " journalled data mode";
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5667 else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA)
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5668 descr = " ordered data mode";
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5669 else
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5670 descr = " writeback data mode";
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5671 } else
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5672 descr = "out journal";
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5673
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5674 if (___ratelimit(&ext4_mount_msg_ratelimit, "EXT4-fs mount"))
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5675 ext4_msg(sb, KERN_INFO, "mounted filesystem with%s. "
cebe85d570cf84 Lukas Czerner 2021-10-27 5676 "Quota mode: %s.", descr, ext4_quota_mode(sb));
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5677
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5678 return 0;
cebe85d570cf84 Lukas Czerner 2021-10-27 5679
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5680 free_sbi:
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5681 ext4_free_sbi(sbi);
cebe85d570cf84 Lukas Czerner 2021-10-27 5682 fc->s_fs_info = NULL;
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5683 return ret;
7edfd85b1ffd36 Lukas Czerner 2021-10-27 5684 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx