diff options
Diffstat (limited to 'fs/hfs/bfind.c')
| -rw-r--r-- | fs/hfs/bfind.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c index ef9498a6e88a..e46f650b5e9c 100644 --- a/fs/hfs/bfind.c +++ b/fs/hfs/bfind.c @@ -16,9 +16,12 @@ int hfs_find_init(struct hfs_btree *tree, struct hfs_find_data *fd) { void *ptr; + if (!tree || !fd) + return -EINVAL; + fd->tree = tree; fd->bnode = NULL; - ptr = kmalloc(tree->max_key_len * 2 + 4, GFP_KERNEL); + ptr = kzalloc(tree->max_key_len * 2 + 4, GFP_KERNEL); if (!ptr) return -ENOMEM; fd->search_key = ptr; @@ -112,6 +115,12 @@ int hfs_brec_find(struct hfs_find_data *fd) __be32 data; int height, res; + fd->record = -1; + fd->keyoffset = -1; + fd->keylength = -1; + fd->entryoffset = -1; + fd->entrylength = -1; + tree = fd->tree; if (fd->bnode) hfs_bnode_put(fd->bnode); |
