linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] resize2fs: fix computation of the real end of the bitmap to be 64-bit
@ 2011-01-07 21:39 Theodore Ts'o
  2011-01-09 10:26 ` Hsuan-Ting
  0 siblings, 1 reply; 2+ messages in thread
From: Theodore Ts'o @ 2011-01-07 21:39 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o

real_end had been previously declared with a bogus type, which is why
this was missed earlier.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 resize/resize2fs.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 55e5512..216a626 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -294,7 +294,7 @@ errcode_t adjust_fs_info(ext2_filsys fs, ext2_filsys old_fs,
 	blk64_t		overhead = 0;
 	blk64_t		rem;
 	blk64_t		blk, group_block;
-	ext2_ino_t	real_end;
+	blk64_t		real_end;
 	blk64_t		adj, old_numblocks, numblocks, adjblocks;
 	unsigned long	i, j, old_desc_blocks, max_group;
 	unsigned int	meta_bg, meta_bg_size;
@@ -381,9 +381,9 @@ retry:
 					    fs->inode_map);
 	if (retval) goto errout;
 
-	real_end = ((EXT2_BLOCKS_PER_GROUP(fs->super)
-		     * fs->group_desc_count)) - 1 +
-			     fs->super->s_first_data_block;
+	real_end = (((blk64_t) EXT2_BLOCKS_PER_GROUP(fs->super) *
+		     fs->group_desc_count)) - 1 +
+		fs->super->s_first_data_block;
 	retval = ext2fs_resize_block_bitmap2(ext2fs_blocks_count(fs->super)-1,
 					    real_end, fs->block_map);
 
-- 
1.7.3.1


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

* Re: [PATCH] resize2fs: fix computation of the real end of the bitmap to be 64-bit
  2011-01-07 21:39 [PATCH] resize2fs: fix computation of the real end of the bitmap to be 64-bit Theodore Ts'o
@ 2011-01-09 10:26 ` Hsuan-Ting
  0 siblings, 0 replies; 2+ messages in thread
From: Hsuan-Ting @ 2011-01-09 10:26 UTC (permalink / raw)
  To: Ext4 Developers List

Hi Ted,

  In function fix_uninit_block_bitmaps(ext2_filsys fs), also have
overflow issue.
I've send this patch before.
http://www.spinics.net/lists/linux-ext4/msg20570.html

Maybe this patch can help you to avoid another overflow bug.

Yours sincerely,
Hsuan-Ting.

2011/1/8 Theodore Ts'o <tytso@mit.edu>
>
> real_end had been previously declared with a bogus type, which is why
> this was missed earlier.
>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> ---
>  resize/resize2fs.c |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/resize/resize2fs.c b/resize/resize2fs.c
> index 55e5512..216a626 100644
> --- a/resize/resize2fs.c
> +++ b/resize/resize2fs.c
> @@ -294,7 +294,7 @@ errcode_t adjust_fs_info(ext2_filsys fs, ext2_filsys old_fs,
>        blk64_t         overhead = 0;
>        blk64_t         rem;
>        blk64_t         blk, group_block;
> -       ext2_ino_t      real_end;
> +       blk64_t         real_end;
>        blk64_t         adj, old_numblocks, numblocks, adjblocks;
>        unsigned long   i, j, old_desc_blocks, max_group;
>        unsigned int    meta_bg, meta_bg_size;
> @@ -381,9 +381,9 @@ retry:
>                                            fs->inode_map);
>        if (retval) goto errout;
>
> -       real_end = ((EXT2_BLOCKS_PER_GROUP(fs->super)
> -                    * fs->group_desc_count)) - 1 +
> -                            fs->super->s_first_data_block;
> +       real_end = (((blk64_t) EXT2_BLOCKS_PER_GROUP(fs->super) *
> +                    fs->group_desc_count)) - 1 +
> +               fs->super->s_first_data_block;
>        retval = ext2fs_resize_block_bitmap2(ext2fs_blocks_count(fs->super)-1,
>                                            real_end, fs->block_map);
>
> --
> 1.7.3.1
>
> --
> 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
--
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

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-07 21:39 [PATCH] resize2fs: fix computation of the real end of the bitmap to be 64-bit Theodore Ts'o
2011-01-09 10:26 ` Hsuan-Ting

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).