aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfs/btree.c
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2008-02-06 04:37:10 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:05 -0500
commit55581d018ed3493d226e7a4d645d9c8a5af6c36b (patch)
treed687d90390073aeb0bda273b7b9f051a36f5d892 /fs/hfs/btree.c
parent7c28cbaed6811260efc0134b984b924cd0ed46f5 (diff)
address hfs on-disk corruption robustness review comments
Address Roman's review comments for the previously sent on-disk corruption hfs robustness patch. - use 0 as a failure value, rather than making a new macro HFS_BAD_KEYLEN, and use a switch statement instead of if's. - Add new fail: target to __hfs_brec_find to skip assignments using bad values when exiting with a failure. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Eric Sandeen <sandeen@redhat.com> Cc: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hfs/btree.c')
-rw-r--r--fs/hfs/btree.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/fs/hfs/btree.c b/fs/hfs/btree.c
index 110dd3515dc8..24cf6fc43021 100644
--- a/fs/hfs/btree.c
+++ b/fs/hfs/btree.c
@@ -81,15 +81,23 @@ struct hfs_btree *hfs_btree_open(struct super_block *sb, u32 id, btree_keycmp ke
81 goto fail_page; 81 goto fail_page;
82 if (!tree->node_count) 82 if (!tree->node_count)
83 goto fail_page; 83 goto fail_page;
84 if ((id == HFS_EXT_CNID) && (tree->max_key_len != HFS_MAX_EXT_KEYLEN)) { 84 switch (id) {
85 printk(KERN_ERR "hfs: invalid extent max_key_len %d\n", 85 case HFS_EXT_CNID:
86 tree->max_key_len); 86 if (tree->max_key_len != HFS_MAX_EXT_KEYLEN) {
87 goto fail_page; 87 printk(KERN_ERR "hfs: invalid extent max_key_len %d\n",
88 } 88 tree->max_key_len);
89 if ((id == HFS_CAT_CNID) && (tree->max_key_len != HFS_MAX_CAT_KEYLEN)) { 89 goto fail_page;
90 printk(KERN_ERR "hfs: invalid catalog max_key_len %d\n", 90 }
91 tree->max_key_len); 91 break;
92 goto fail_page; 92 case HFS_CAT_CNID:
93 if (tree->max_key_len != HFS_MAX_CAT_KEYLEN) {
94 printk(KERN_ERR "hfs: invalid catalog max_key_len %d\n",
95 tree->max_key_len);
96 goto fail_page;
97 }
98 break;
99 default:
100 BUG();
93 } 101 }
94 102
95 tree->node_size_shift = ffs(size) - 1; 103 tree->node_size_shift = ffs(size) - 1;