diff mbox

[1/2] ext3: fix possible non-initialized variable on htree_dirblock_to_tree()

Message ID 1349121055-8168-2-git-send-email-cmaiolino@redhat.com
State Not Applicable, archived
Headers show

Commit Message

Carlos Maiolino Oct. 1, 2012, 7:50 p.m. UTC
This is a backport of ext4 commit 90b0a9732 which fixes a possible
non-initialized variable on htree_dirblock_to_tree().
Ext3 has the same non initialized variable, but, in any case it will be
initialized by ext3_get_blocks_handle(), which will avoid the bug to be
triggered, but, the non-initialized variable by htree_dirblock_to_tree() is
still a bug.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
---
 fs/ext3/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jan Kara Oct. 2, 2012, 1:55 p.m. UTC | #1
On Mon 01-10-12 16:50:54, Carlos Maiolino wrote:
> This is a backport of ext4 commit 90b0a9732 which fixes a possible
> non-initialized variable on htree_dirblock_to_tree().
> Ext3 has the same non initialized variable, but, in any case it will be
> initialized by ext3_get_blocks_handle(), which will avoid the bug to be
> triggered, but, the non-initialized variable by htree_dirblock_to_tree() is
> still a bug.
  This is a good cleanup. I've taken that into my tree.

								Honza

> 
> Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
>  fs/ext3/namei.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
> index 8f4fdda..7f6c938 100644
> --- a/fs/ext3/namei.c
> +++ b/fs/ext3/namei.c
> @@ -559,7 +559,7 @@ static int htree_dirblock_to_tree(struct file *dir_file,
>  {
>  	struct buffer_head *bh;
>  	struct ext3_dir_entry_2 *de, *top;
> -	int err, count = 0;
> +	int err = 0, count = 0;
>  
>  	dxtrace(printk("In htree dirblock_to_tree: block %d\n", block));
>  	if (!(bh = ext3_bread (NULL, dir, block, 0, &err)))
> -- 
> 1.7.11.4
> 
> --
> 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
diff mbox

Patch

diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 8f4fdda..7f6c938 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -559,7 +559,7 @@  static int htree_dirblock_to_tree(struct file *dir_file,
 {
 	struct buffer_head *bh;
 	struct ext3_dir_entry_2 *de, *top;
-	int err, count = 0;
+	int err = 0, count = 0;
 
 	dxtrace(printk("In htree dirblock_to_tree: block %d\n", block));
 	if (!(bh = ext3_bread (NULL, dir, block, 0, &err)))