diff options
Diffstat (limited to 'fs/ext3/dir.c')
-rw-r--r-- | fs/ext3/dir.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index fbb0d4ed07d4..429acbb4e064 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c | |||
@@ -59,7 +59,7 @@ static unsigned char get_dtype(struct super_block *sb, int filetype) | |||
59 | 59 | ||
60 | return (ext3_filetype_table[filetype]); | 60 | return (ext3_filetype_table[filetype]); |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | int ext3_check_dir_entry (const char * function, struct inode * dir, | 64 | int ext3_check_dir_entry (const char * function, struct inode * dir, |
65 | struct ext3_dir_entry_2 * de, | 65 | struct ext3_dir_entry_2 * de, |
@@ -67,7 +67,7 @@ int ext3_check_dir_entry (const char * function, struct inode * dir, | |||
67 | unsigned long offset) | 67 | unsigned long offset) |
68 | { | 68 | { |
69 | const char * error_msg = NULL; | 69 | const char * error_msg = NULL; |
70 | const int rlen = le16_to_cpu(de->rec_len); | 70 | const int rlen = le16_to_cpu(de->rec_len); |
71 | 71 | ||
72 | if (rlen < EXT3_DIR_REC_LEN(1)) | 72 | if (rlen < EXT3_DIR_REC_LEN(1)) |
73 | error_msg = "rec_len is smaller than minimal"; | 73 | error_msg = "rec_len is smaller than minimal"; |
@@ -162,7 +162,7 @@ revalidate: | |||
162 | * to make sure. */ | 162 | * to make sure. */ |
163 | if (filp->f_version != inode->i_version) { | 163 | if (filp->f_version != inode->i_version) { |
164 | for (i = 0; i < sb->s_blocksize && i < offset; ) { | 164 | for (i = 0; i < sb->s_blocksize && i < offset; ) { |
165 | de = (struct ext3_dir_entry_2 *) | 165 | de = (struct ext3_dir_entry_2 *) |
166 | (bh->b_data + i); | 166 | (bh->b_data + i); |
167 | /* It's too expensive to do a full | 167 | /* It's too expensive to do a full |
168 | * dirent test each time round this | 168 | * dirent test each time round this |
@@ -181,7 +181,7 @@ revalidate: | |||
181 | filp->f_version = inode->i_version; | 181 | filp->f_version = inode->i_version; |
182 | } | 182 | } |
183 | 183 | ||
184 | while (!error && filp->f_pos < inode->i_size | 184 | while (!error && filp->f_pos < inode->i_size |
185 | && offset < sb->s_blocksize) { | 185 | && offset < sb->s_blocksize) { |
186 | de = (struct ext3_dir_entry_2 *) (bh->b_data + offset); | 186 | de = (struct ext3_dir_entry_2 *) (bh->b_data + offset); |
187 | if (!ext3_check_dir_entry ("ext3_readdir", inode, de, | 187 | if (!ext3_check_dir_entry ("ext3_readdir", inode, de, |
@@ -229,7 +229,7 @@ out: | |||
229 | /* | 229 | /* |
230 | * These functions convert from the major/minor hash to an f_pos | 230 | * These functions convert from the major/minor hash to an f_pos |
231 | * value. | 231 | * value. |
232 | * | 232 | * |
233 | * Currently we only use major hash numer. This is unfortunate, but | 233 | * Currently we only use major hash numer. This is unfortunate, but |
234 | * on 32-bit machines, the same VFS interface is used for lseek and | 234 | * on 32-bit machines, the same VFS interface is used for lseek and |
235 | * llseek, so if we use the 64 bit offset, then the 32-bit versions of | 235 | * llseek, so if we use the 64 bit offset, then the 32-bit versions of |
@@ -250,7 +250,7 @@ out: | |||
250 | struct fname { | 250 | struct fname { |
251 | __u32 hash; | 251 | __u32 hash; |
252 | __u32 minor_hash; | 252 | __u32 minor_hash; |
253 | struct rb_node rb_hash; | 253 | struct rb_node rb_hash; |
254 | struct fname *next; | 254 | struct fname *next; |
255 | __u32 inode; | 255 | __u32 inode; |
256 | __u8 name_len; | 256 | __u8 name_len; |
@@ -343,10 +343,9 @@ int ext3_htree_store_dirent(struct file *dir_file, __u32 hash, | |||
343 | 343 | ||
344 | /* Create and allocate the fname structure */ | 344 | /* Create and allocate the fname structure */ |
345 | len = sizeof(struct fname) + dirent->name_len + 1; | 345 | len = sizeof(struct fname) + dirent->name_len + 1; |
346 | new_fn = kmalloc(len, GFP_KERNEL); | 346 | new_fn = kzalloc(len, GFP_KERNEL); |
347 | if (!new_fn) | 347 | if (!new_fn) |
348 | return -ENOMEM; | 348 | return -ENOMEM; |
349 | memset(new_fn, 0, len); | ||
350 | new_fn->hash = hash; | 349 | new_fn->hash = hash; |
351 | new_fn->minor_hash = minor_hash; | 350 | new_fn->minor_hash = minor_hash; |
352 | new_fn->inode = le32_to_cpu(dirent->inode); | 351 | new_fn->inode = le32_to_cpu(dirent->inode); |
@@ -410,7 +409,7 @@ static int call_filldir(struct file * filp, void * dirent, | |||
410 | curr_pos = hash2pos(fname->hash, fname->minor_hash); | 409 | curr_pos = hash2pos(fname->hash, fname->minor_hash); |
411 | while (fname) { | 410 | while (fname) { |
412 | error = filldir(dirent, fname->name, | 411 | error = filldir(dirent, fname->name, |
413 | fname->name_len, curr_pos, | 412 | fname->name_len, curr_pos, |
414 | fname->inode, | 413 | fname->inode, |
415 | get_dtype(sb, fname->file_type)); | 414 | get_dtype(sb, fname->file_type)); |
416 | if (error) { | 415 | if (error) { |
@@ -465,7 +464,7 @@ static int ext3_dx_readdir(struct file * filp, | |||
465 | /* | 464 | /* |
466 | * Fill the rbtree if we have no more entries, | 465 | * Fill the rbtree if we have no more entries, |
467 | * or the inode has changed since we last read in the | 466 | * or the inode has changed since we last read in the |
468 | * cached entries. | 467 | * cached entries. |
469 | */ | 468 | */ |
470 | if ((!info->curr_node) || | 469 | if ((!info->curr_node) || |
471 | (filp->f_version != inode->i_version)) { | 470 | (filp->f_version != inode->i_version)) { |