linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] ext4: error handling fix in ext4_ext_convert_to_initialized()
@ 2011-10-11 13:49 Dan Carpenter
  2011-10-26  8:00 ` Ted Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-10-11 13:49 UTC (permalink / raw)
  To: Theodore Ts'o, Yongqiang Yang
  Cc: Andreas Dilger, linux-ext4, kernel-janitors

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.

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;
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] ext4: error handling fix in ext4_ext_convert_to_initialized()
  2011-10-11 13:49 [patch] ext4: error handling fix in ext4_ext_convert_to_initialized() Dan Carpenter
@ 2011-10-26  8:00 ` Ted Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Ted Ts'o @ 2011-10-26  8:00 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Yongqiang Yang, Andreas Dilger, linux-ext4, kernel-janitors

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-26  8:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-11 13:49 [patch] ext4: error handling fix in ext4_ext_convert_to_initialized() Dan Carpenter
2011-10-26  8:00 ` Ted Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).