From: hyl <heyongli@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] btrfsck open_ctree sanity check
Date: Sat, 15 Nov 2008 19:29:48 +0800 [thread overview]
Message-ID: <491EB2AC.2020506@gmail.com> (raw)
i.e Permission denied, open_ctree will return NULL, then lead
to a segment fault later.
Signed-off-by Yongli He <heyongli@gmail.com>
---
btrfsck.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/btrfsck.c b/btrfsck.c
index 801249b..86c2eeb 100644
--- a/btrfsck.c
+++ b/btrfsck.c
@@ -770,6 +770,11 @@ int main(int ac, char **av) {
cache_tree_init(&reada);
root = open_ctree(av[1], 0, 0);
+ if(!root){
+ perror("open");
+ exit(1);
+ }
+
bits_nr = 1024;
bits = malloc(bits_nr * sizeof(struct block_info));
--
1.5.4.3
reply other threads:[~2008-11-15 11:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=491EB2AC.2020506@gmail.com \
--to=heyongli@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox