diff mbox

ext4: error handling fix in ext4_ext_convert_to_initialized()

Message ID 20111011134912.GB27127@elgon.mountain
State Accepted, archived
Headers show

Commit Message

Dan Carpenter Oct. 11, 2011, 1:49 p.m. UTC
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

Comments

Theodore Ts'o Oct. 26, 2011, 8 a.m. UTC | #1
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
diff mbox

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;