1 ext4: make sure ex.fe_logical is initialized
3 The lowest levels of mballoc set all of the fields of struct
4 ext4_free_extent except for fe_logical, since they are just trying to
5 find the requested free set of blocks, and the logical block hasn't
6 been set yet. This makes some static code checkers sad. Set it to
7 various different debug values, which would be useful when
8 debugging mballoc if these values were to ever show up due to the
9 parts of mballoc triyng to use ac->ac_b_ex.fe_logical before it is
10 properly upper layers of mballoc failing to properly set, usually by
11 ext4_mb_use_best_found().
13 Addresses-Coverity-Id: #139697
14 Addresses-Coverity-Id: #139698
15 Addresses-Coverity-Id: #139699
17 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
21 fs/ext4/mballoc.c | 4 +++-
22 1 file changed, 3 insertions(+), 1 deletion(-)
24 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
25 index 04a5c75..0d42f63 100644
26 --- a/fs/ext4/mballoc.c
27 +++ b/fs/ext4/mballoc.c
28 @@ -1808,6 +1808,7 @@ int ext4_mb_find_by_goal(struct ext4_allocation_context *ac,
29 ext4_lock_group(ac->ac_sb, group);
30 max = mb_find_extent(e4b, ac->ac_g_ex.fe_start,
31 ac->ac_g_ex.fe_len, &ex);
32 + ex.fe_logical = 0xDEADFA11; /* debug value */
34 if (max >= ac->ac_g_ex.fe_len && ac->ac_g_ex.fe_len == sbi->s_stripe) {
36 @@ -1936,7 +1937,7 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
41 + ex.fe_logical = 0xDEADC0DE; /* debug value */
42 ext4_mb_measure_extent(ac, &ex, e4b);
45 @@ -1977,6 +1978,7 @@ void ext4_mb_scan_aligned(struct ext4_allocation_context *ac,
46 max = mb_find_extent(e4b, i, sbi->s_stripe, &ex);
47 if (max >= sbi->s_stripe) {
49 + ex.fe_logical = 0xDEADF00D; /* debug value */
51 ext4_mb_use_best_found(ac, e4b);