aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hfs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hfs/dir.c')
-rw-r--r--fs/hfs/dir.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 5f7f1abd5f6d..17c22a8fd40a 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -25,7 +25,9 @@ static struct dentry *hfs_lookup(struct inode *dir, struct dentry *dentry,
25 struct inode *inode = NULL; 25 struct inode *inode = NULL;
26 int res; 26 int res;
27 27
28 hfs_find_init(HFS_SB(dir->i_sb)->cat_tree, &fd); 28 res = hfs_find_init(HFS_SB(dir->i_sb)->cat_tree, &fd);
29 if (res)
30 return ERR_PTR(res);
29 hfs_cat_build_key(dir->i_sb, fd.search_key, dir->i_ino, &dentry->d_name); 31 hfs_cat_build_key(dir->i_sb, fd.search_key, dir->i_ino, &dentry->d_name);
30 res = hfs_brec_read(&fd, &rec, sizeof(rec)); 32 res = hfs_brec_read(&fd, &rec, sizeof(rec));
31 if (res) { 33 if (res) {
@@ -63,7 +65,9 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
63 if (filp->f_pos >= inode->i_size) 65 if (filp->f_pos >= inode->i_size)
64 return 0; 66 return 0;
65 67
66 hfs_find_init(HFS_SB(sb)->cat_tree, &fd); 68 err = hfs_find_init(HFS_SB(sb)->cat_tree, &fd);
69 if (err)
70 return err;
67 hfs_cat_build_key(sb, fd.search_key, inode->i_ino, NULL); 71 hfs_cat_build_key(sb, fd.search_key, inode->i_ino, NULL);
68 err = hfs_brec_find(&fd); 72 err = hfs_brec_find(&fd);
69 if (err) 73 if (err)
@@ -84,12 +88,12 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
84 88
85 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength); 89 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength);
86 if (entry.type != HFS_CDR_THD) { 90 if (entry.type != HFS_CDR_THD) {
87 printk(KERN_ERR "hfs: bad catalog folder thread\n"); 91 pr_err("bad catalog folder thread\n");
88 err = -EIO; 92 err = -EIO;
89 goto out; 93 goto out;
90 } 94 }
91 //if (fd.entrylength < HFS_MIN_THREAD_SZ) { 95 //if (fd.entrylength < HFS_MIN_THREAD_SZ) {
92 // printk(KERN_ERR "hfs: truncated catalog thread\n"); 96 // pr_err("truncated catalog thread\n");
93 // err = -EIO; 97 // err = -EIO;
94 // goto out; 98 // goto out;
95 //} 99 //}
@@ -108,7 +112,7 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
108 112
109 for (;;) { 113 for (;;) {
110 if (be32_to_cpu(fd.key->cat.ParID) != inode->i_ino) { 114 if (be32_to_cpu(fd.key->cat.ParID) != inode->i_ino) {
111 printk(KERN_ERR "hfs: walked past end of dir\n"); 115 pr_err("walked past end of dir\n");
112 err = -EIO; 116 err = -EIO;
113 goto out; 117 goto out;
114 } 118 }
@@ -123,7 +127,7 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
123 len = hfs_mac2asc(sb, strbuf, &fd.key->cat.CName); 127 len = hfs_mac2asc(sb, strbuf, &fd.key->cat.CName);
124 if (type == HFS_CDR_DIR) { 128 if (type == HFS_CDR_DIR) {
125 if (fd.entrylength < sizeof(struct hfs_cat_dir)) { 129 if (fd.entrylength < sizeof(struct hfs_cat_dir)) {
126 printk(KERN_ERR "hfs: small dir entry\n"); 130 pr_err("small dir entry\n");
127 err = -EIO; 131 err = -EIO;
128 goto out; 132 goto out;
129 } 133 }
@@ -132,7 +136,7 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
132 break; 136 break;
133 } else if (type == HFS_CDR_FIL) { 137 } else if (type == HFS_CDR_FIL) {
134 if (fd.entrylength < sizeof(struct hfs_cat_file)) { 138 if (fd.entrylength < sizeof(struct hfs_cat_file)) {
135 printk(KERN_ERR "hfs: small file entry\n"); 139 pr_err("small file entry\n");
136 err = -EIO; 140 err = -EIO;
137 goto out; 141 goto out;
138 } 142 }
@@ -140,7 +144,7 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
140 be32_to_cpu(entry.file.FlNum), DT_REG)) 144 be32_to_cpu(entry.file.FlNum), DT_REG))
141 break; 145 break;
142 } else { 146 } else {
143 printk(KERN_ERR "hfs: bad catalog entry type %d\n", type); 147 pr_err("bad catalog entry type %d\n", type);
144 err = -EIO; 148 err = -EIO;
145 goto out; 149 goto out;
146 } 150 }