aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/move_extent.c
diff options
context:
space:
mode:
authorAkria Fujita <a-fujita@rs.jp.nec.com>2013-02-01 20:52:46 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-02-01 20:52:46 -0500
commit87e698734b9e618276c797092ccdd91da292d10e (patch)
treecc78a0610c63ca864a44bb87e0059ce7ae4fea27 /fs/ext4/move_extent.c
parent524c19ebc961799b1ec126e4b063b941a70275e5 (diff)
ext4: fix smatch warning in move_extent.c's mext_replace_branches()
Commit 2147b1a6a48 resulted in a new smatch warning: > fs/ext4/move_extent.c:693 mext_replace_branches() > warn: variable dereferenced before check 'dext' (see line 683) Fix this by adding a check to make sure dext is non-NULL before we derefrence it. Signed-off-by: Akria Fujita <a-fujita@rs.jp.nec.com> [ modified by tytso to make sure an ext4_error is called ] Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/move_extent.c')
-rw-r--r--fs/ext4/move_extent.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index d9cc5ee42f53..e4cdb5188f34 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -681,6 +681,8 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
681 681
682 depth = ext_depth(donor_inode); 682 depth = ext_depth(donor_inode);
683 dext = donor_path[depth].p_ext; 683 dext = donor_path[depth].p_ext;
684 if (unlikely(!dext))
685 goto missing_donor_extent;
684 tmp_dext = *dext; 686 tmp_dext = *dext;
685 687
686 *err = mext_calc_swap_extents(&tmp_dext, &tmp_oext, orig_off, 688 *err = mext_calc_swap_extents(&tmp_dext, &tmp_oext, orig_off,
@@ -691,7 +693,8 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
691 /* Loop for the donor extents */ 693 /* Loop for the donor extents */
692 while (1) { 694 while (1) {
693 /* The extent for donor must be found. */ 695 /* The extent for donor must be found. */
694 if (!dext) { 696 if (unlikely(!dext)) {
697 missing_donor_extent:
695 EXT4_ERROR_INODE(donor_inode, 698 EXT4_ERROR_INODE(donor_inode,
696 "The extent for donor must be found"); 699 "The extent for donor must be found");
697 *err = -EIO; 700 *err = -EIO;