lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Fri, 9 Oct 2020 15:17:44 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org,
        Harshad Shirwadkar <harshadshirwadkar@...il.com>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org, linux-ext4@...r.kernel.org,
        "Theodore Ts'o" <tytso@....edu>
Subject: [ext4:dev 9/44] fs/ext4/fast_commit.c:1135 ext4_fc_commit() error:
 uninitialized symbol 'start_time'.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
head:   ab7b179af3f98772f2433ddc4ace6b7924a4e862
commit: 96df8fb629b26ce3b0b10c9b730965788786bb8c [9/44] ext4: main fast-commit commit path
config: i386-randconfig-m021-20201009 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>

smatch warnings:
fs/ext4/fast_commit.c:1135 ext4_fc_commit() error: uninitialized symbol 'start_time'.

vim +/start_time +1135 fs/ext4/fast_commit.c

96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1068  int ext4_fc_commit(journal_t *journal, tid_t commit_tid)
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1069  {
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1070  	struct super_block *sb = (struct super_block *)(journal->j_private);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1071  	struct ext4_sb_info *sbi = EXT4_SB(sb);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1072  	int nblks = 0, ret, bsize = journal->j_blocksize;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1073  	int subtid = atomic_read(&sbi->s_fc_subtid);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1074  	int reason = EXT4_FC_REASON_OK, fc_bufs_before = 0;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1075  	ktime_t start_time, commit_time;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1076  
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1077  	trace_ext4_fc_commit_start(sb);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1078  
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1079  	if (!test_opt2(sb, JOURNAL_FAST_COMMIT) ||
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1080  		(ext4_fc_is_ineligible(sb))) {
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1081  		reason = EXT4_FC_REASON_INELIGIBLE;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1082  		goto out;
                                                                ^^^^^^^^^
"start_time" needs to be initialized first at the very start of the
function.

96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1083  	}
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1084  
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1085  	start_time = ktime_get();
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1086  restart_fc:
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1087  	ret = jbd2_fc_start(journal, commit_tid);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1088  	if (ret == -EALREADY) {
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1089  		/* There was an ongoing commit, check if we need to restart */
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1090  		if (atomic_read(&sbi->s_fc_subtid) <= subtid &&
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1091  			commit_tid > journal->j_commit_sequence)
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1092  			goto restart_fc;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1093  		reason = EXT4_FC_REASON_ALREADY_COMMITTED;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1094  		goto out;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1095  	} else if (ret) {
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1096  		sbi->s_fc_stats.fc_ineligible_reason_count[EXT4_FC_COMMIT_FAILED]++;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1097  		reason = EXT4_FC_REASON_FC_START_FAILED;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1098  		goto out;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1099  	}
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1100  
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1101  	fc_bufs_before = (sbi->s_fc_bytes + bsize - 1) / bsize;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1102  	ret = ext4_fc_perform_commit(journal);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1103  	if (ret < 0) {
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1104  		sbi->s_fc_stats.fc_ineligible_reason_count[EXT4_FC_COMMIT_FAILED]++;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1105  		reason = EXT4_FC_REASON_FC_FAILED;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1106  		goto out;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1107  	}
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1108  	nblks = (sbi->s_fc_bytes + bsize - 1) / bsize - fc_bufs_before;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1109  	ret = jbd2_fc_wait_bufs(journal, nblks);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1110  	if (ret < 0) {
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1111  		sbi->s_fc_stats.fc_ineligible_reason_count[EXT4_FC_COMMIT_FAILED]++;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1112  		reason = EXT4_FC_REASON_FC_FAILED;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1113  		goto out;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1114  	}
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1115  	atomic_inc(&sbi->s_fc_subtid);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1116  	jbd2_fc_stop(journal);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1117  out:
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1118  	/* Has any ineligible update happened since we started? */
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1119  	if (reason == EXT4_FC_REASON_OK && ext4_fc_is_ineligible(sb)) {
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1120  		sbi->s_fc_stats.fc_ineligible_reason_count[EXT4_FC_COMMIT_FAILED]++;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1121  		reason = EXT4_FC_REASON_INELIGIBLE;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1122  	}
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1123  
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1124  	spin_lock(&sbi->s_fc_lock);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1125  	if (reason != EXT4_FC_REASON_OK &&
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1126  		reason != EXT4_FC_REASON_ALREADY_COMMITTED) {
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1127  		sbi->s_fc_stats.fc_ineligible_commits++;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1128  	} else {
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1129  		sbi->s_fc_stats.fc_num_commits++;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1130  		sbi->s_fc_stats.fc_numblks += nblks;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1131  	}
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1132  	spin_unlock(&sbi->s_fc_lock);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1133  	nblks = (reason == EXT4_FC_REASON_OK) ? nblks : 0;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1134  	trace_ext4_fc_commit_stop(sb, nblks, reason);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18 @1135  	commit_time = ktime_to_ns(ktime_sub(ktime_get(), start_time));
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1136  	/*
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1137  	 * weight the commit time higher than the average time so we don't
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1138  	 * react too strongly to vast changes in the commit time
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1139  	 */
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1140  	if (likely(sbi->s_fc_avg_commit_time))
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1141  		sbi->s_fc_avg_commit_time = (commit_time +
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1142  				sbi->s_fc_avg_commit_time * 3) / 4;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1143  	else
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1144  		sbi->s_fc_avg_commit_time = commit_time;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1145  	jbd_debug(1,
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1146  		"Fast commit ended with blks = %d, reason = %d, subtid - %d",
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1147  		nblks, reason, subtid);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1148  	if (reason == EXT4_FC_REASON_FC_FAILED)
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1149  		return jbd2_fc_stop_do_commit(journal, commit_tid);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1150  	if (reason == EXT4_FC_REASON_FC_START_FAILED ||
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1151  		reason == EXT4_FC_REASON_INELIGIBLE)
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1152  		return jbd2_complete_transaction(journal, commit_tid);
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1153  	return 0;
96df8fb629b26ce Harshad Shirwadkar 2020-09-18  1154  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (35116 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ