From 4bdf4a05b1f5aaf3a99e70a4e51eb319dbf9df33 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 20 Feb 2014 00:37:43 -0500 Subject: [PATCH] add patch initialize-fe_logical --- initialize-fe_logical | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ series | 1 + 2 files changed, 53 insertions(+) create mode 100644 initialize-fe_logical diff --git a/initialize-fe_logical b/initialize-fe_logical new file mode 100644 index 00000000..63db8d79 --- /dev/null +++ b/initialize-fe_logical @@ -0,0 +1,52 @@ +ext4: make sure ex.fe_logical is initialized + +The lowest levels of mballoc set all of the fields of struct +ext4_free_extent except for fe_logical, since they are just trying to +find the requested free set of blocks, and the logical block hasn't +been set yet. This makes some static code checkers sad. Set it to +various different debug values, which would be useful when +debugging mballoc if these values were to ever show up due to the +parts of mballoc triyng to use ac->ac_b_ex.fe_logical before it is +properly upper layers of mballoc failing to properly set, usually by +ext4_mb_use_best_found(). + +Addresses-Coverity-Id: #139697 +Addresses-Coverity-Id: #139698 +Addresses-Coverity-Id: #139699 + +Signed-off-by: "Theodore Ts'o" + + +--- + fs/ext4/mballoc.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c +index 04a5c75..0d42f63 100644 +--- a/fs/ext4/mballoc.c ++++ b/fs/ext4/mballoc.c +@@ -1808,6 +1808,7 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac, + ext4_lock_group(ac->ac_sb, group); + max = mb_find_extent(e4b, ac->ac_g_ex.fe_start, + ac->ac_g_ex.fe_len, &ex); ++ ex.fe_logical = 0xDEADFA11; /* debug value */ + + if (max >= ac->ac_g_ex.fe_len && ac->ac_g_ex.fe_len == sbi->s_stripe) { + ext4_fsblk_t start; +@@ -1936,7 +1937,7 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac, + */ + break; + } +- ++ ex.fe_logical = 0xDEADC0DE; /* debug value */ + ext4_mb_measure_extent(ac, &ex, e4b); + + i += ex.fe_len; +@@ -1977,6 +1978,7 @@ void ext4_mb_scan_aligned(struct ext4_allocation_context *ac, + max = mb_find_extent(e4b, i, sbi->s_stripe, &ex); + if (max >= sbi->s_stripe) { + ac->ac_found++; ++ ex.fe_logical = 0xDEADF00D; /* debug value */ + ac->ac_b_ex = ex; + ext4_mb_use_best_found(ac, e4b); + break; diff --git a/series b/series index 761f025a..f1e22da7 100644 --- a/series +++ b/series @@ -19,6 +19,7 @@ address-a-benign-compiler-warning fix-error-return-from-ext4_ext_handle_uninitialized_extents add-ext4_es_store_pblock_status ext4-dont-calculate-total-xattr-size-if-unneeded +initialize-fe_logical ########################################## # unstable patches -- 2.11.4.GIT