Re: [PATCH 01/13] btrfs-progs: btrfs-image.c: Added NULL pointer check.

2013-01-23 Thread Gene Czarcinski

On 01/21/2013 10:56 AM, David Sterba wrote:

On Sun, Jan 20, 2013 at 04:04:06PM -0500, Gene Czarcinski wrote:

>From: Nageswara R Sastry
>
>Check for the return value of 'open_ctree()' before dereferencing it.
>
>--- a/btrfs-image.c
>+++ b/btrfs-image.c
>@@ -491,6 +491,7 @@ static int create_metadump(const char *input, FILE *out, 
int num_threads,
>int ret;
>  
>  	root = open_ctree(input, 0, 0);

>+   BUG_ON(!root);

Bug_on is not the right fix here, I prefer a more extensive fix

http://permalink.gmane.org/gmane.comp.file-systems.btrfs/15305

which prints a message and exits.

The above patch is 1 of 4 that were submitted.  Should those other three 
be included also.  I did a couple of spot checks and the changes were 
not picked up in another patch.


A couple of things bother me about these 4 patches.  First of all, 
nobody commented about them on this mailing list --- either good or 
bad.  Second, if the descriptions and code is at all accurate, why were 
these patches not included in the "flury" of patches applied later in 
the year to bring btrfs-progs more up-to-date?


These patches may "look good" but almost none of the changes will apply 
to "integration-20130121" or "91d9eec".
So some effort will be needed to refit/rebase these patches.  I am 
willing to do that if there is some agreement that this should be done.  
Of the 4 patches, the one addressing segfaults is the most serious.  The 
others deal with simple problems including one which changes spaces to 
tab characters.


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


Re: [PATCH 01/13] btrfs-progs: btrfs-image.c: Added NULL pointer check.

2013-01-23 Thread David Sterba
On Tue, Jan 22, 2013 at 12:34:01PM -0500, Gene Czarcinski wrote:
> I missed this better fix because I only started looking for outstanding
> patches starting in June/July 2012.

No problem, there are multuple patches for some longstanging bugs, or
several versions of patch series. This is something we need to be able
to deal with anyway.

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


Re: [PATCH 01/13] btrfs-progs: btrfs-image.c: Added NULL pointer check.

2013-01-22 Thread Gene Czarcinski

On 01/21/2013 10:56 AM, David Sterba wrote:

On Sun, Jan 20, 2013 at 04:04:06PM -0500, Gene Czarcinski wrote:

From: Nageswara R Sastry 

Check for the return value of 'open_ctree()' before dereferencing it.

--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -491,6 +491,7 @@ static int create_metadump(const char *input, FILE *out, 
int num_threads,
int ret;
  
  	root = open_ctree(input, 0, 0);

+   BUG_ON(!root);

Bug_on is not the right fix here, I prefer a more extensive fix

http://permalink.gmane.org/gmane.comp.file-systems.btrfs/15305

which prints a message and exits.


BUG_ON(root->nodesize != root->leafsize);
  
  	ret = metadump_init(&metadump, root, out, num_threads,
I missed this better fix because I only started looking for outstanding 
patches starting in June/July 2012.


Besides, I suspect you are a lot more knowledgeable to make the judgment 
as to a "good" fix.


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


Re: [PATCH 01/13] btrfs-progs: btrfs-image.c: Added NULL pointer check.

2013-01-21 Thread David Sterba
On Sun, Jan 20, 2013 at 04:04:06PM -0500, Gene Czarcinski wrote:
> From: Nageswara R Sastry 
> 
> Check for the return value of 'open_ctree()' before dereferencing it.
> 
> --- a/btrfs-image.c
> +++ b/btrfs-image.c
> @@ -491,6 +491,7 @@ static int create_metadump(const char *input, FILE *out, 
> int num_threads,
>   int ret;
>  
>   root = open_ctree(input, 0, 0);
> + BUG_ON(!root);

Bug_on is not the right fix here, I prefer a more extensive fix

http://permalink.gmane.org/gmane.comp.file-systems.btrfs/15305

which prints a message and exits.

>   BUG_ON(root->nodesize != root->leafsize);
>  
>   ret = metadump_init(&metadump, root, out, num_threads,
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/13] btrfs-progs: btrfs-image.c: Added NULL pointer check.

2013-01-20 Thread Gene Czarcinski
From: Nageswara R Sastry 

Check for the return value of 'open_ctree()' before dereferencing it.

Signed-off-by: Nageswara R Sastry 
Signed-off-by: Gene Czarcinski 
---
 btrfs-image.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/btrfs-image.c b/btrfs-image.c
index f2bbcc8..2a33a55 100644
--- a/btrfs-image.c
+++ b/btrfs-image.c
@@ -491,6 +491,7 @@ static int create_metadump(const char *input, FILE *out, 
int num_threads,
int ret;
 
root = open_ctree(input, 0, 0);
+   BUG_ON(!root);
BUG_ON(root->nodesize != root->leafsize);
 
ret = metadump_init(&metadump, root, out, num_threads,
-- 
1.8.1

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