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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <nasastry@xxxxxxxxxx>

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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux