Patchwork ext4: error handling fix in ext4_ext_convert_to_initialized()

login
register
mail settings
Submitter Dan Carpenter
Date Oct. 11, 2011, 1:49 p.m.
Message ID <20111011134912.GB27127@elgon.mountain>
Download mbox | patch
Permalink /patch/118983/
State Accepted
Headers show

Comments

Dan Carpenter - Oct. 11, 2011, 1:49 p.m.
When allocated is unsiged it breaks the error handling at the end
of the function when we call:
	allocated = ext4_split_extent(...);
	if (allocated < 0)
		err = allocated;

I've made it a signed int instead of unsigned.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
You guys know I'm not an ext4 expert.  I can't swear that the math
all works correctly with a signed int.  I'm pretty sure it does, but
please review this carefully.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Theodore Ts'o - Oct. 26, 2011, 8 a.m.
On Tue, Oct 11, 2011 at 04:49:12PM +0300, Dan Carpenter wrote:
> When allocated is unsiged it breaks the error handling at the end
> of the function when we call:
> 	allocated = ext4_split_extent(...);
> 	if (allocated < 0)
> 		err = allocated;
> 
> I've made it a signed int instead of unsigned.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks, applied.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 57cf568..d65b268 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2919,7 +2919,8 @@  static int ext4_ext_convert_to_initialized(handle_t *handle,
 	struct ext4_extent zero_ex;
 	struct ext4_extent *ex;
 	ext4_lblk_t ee_block, eof_block;
-	unsigned int allocated, ee_len, depth;
+	unsigned int ee_len, depth;
+	int allocated;
 	int err = 0;
 	int split_flag = 0;