The function hfs_bnode_find() can return an error pointer and is not checked for one. Add error pointer check. Detected by Smatch: fs/hfsplus/brec.c:441 hfs_brec_update_parent() error: 'fd->bnode' dereferencing possible ERR_PTR() Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Ethan Tidmore --- fs/hfsplus/brec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/hfsplus/brec.c b/fs/hfsplus/brec.c index 6796c1a80e99..efe79a8f1d98 100644 --- a/fs/hfsplus/brec.c +++ b/fs/hfsplus/brec.c @@ -434,6 +434,9 @@ static int hfs_brec_update_parent(struct hfs_find_data *fd) new_node->parent = tree->root; } fd->bnode = hfs_bnode_find(tree, new_node->parent); + if (IS_ERR(fd->bnode)) + return PTR_ERR(fd->bnode); + /* create index key and entry */ hfs_bnode_read_key(new_node, fd->search_key, 14); cnid = cpu_to_be32(new_node->this); -- 2.53.0