From: Dan Carpenter Date: Wed, 14 Aug 2013 17:55:49 +0000 (-0700) Subject: pstore: d_alloc_name() doesn't return an ERR_PTR X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=d6dd0c8127040899f815c2ed1667eb1b0b684f51;p=linux-edison.git pstore: d_alloc_name() doesn't return an ERR_PTR commit c39524e6744284452ef45480d3153bec28960c32 upstream. d_alloc_name() returns NULL on error. Also I changed the error code from -ENOSPC to -ENOMEM to reflect that we were short on RAM not disk space. Signed-off-by: Dan Carpenter Acked-by: Kees Cook Signed-off-by: Tony Luck Cc: HuKeping Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index eaba02d951d..66c8c2fe86b 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c @@ -336,9 +336,8 @@ int pstore_mkfile(enum pstore_type_id type, char *psname, u64 id, int count, mutex_lock(&root->d_inode->i_mutex); - rc = -ENOSPC; dentry = d_alloc_name(root, name); - if (IS_ERR(dentry)) + if (!dentry) goto fail_lockedalloc; memcpy(private->data, data, size);