pstore: d_alloc_name() doesn't return an ERR_PTR
Subsystems (2)
PATCH 1/1 pstore: d_alloc_name() doesn't return an ERR_PTR
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 <[email protected]>
fs/pstore/inode.c +1 -2
@@ -345,9 +345,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);
Quoted 5 lines · Dan Carpenter
d_alloc_name()returns NULL on error. Also I changed the error code from-ENOSPCto-ENOMEMto reflect that we were short on RAM not disk space.Signed-off-by Dan Carpenter <[email protected]>
Thanks for the catch!
Acked-by Kees Cook <[email protected]>
Signature · 2 lines
Kees Cook Chrome OS Security
Luck, Tony
reviewerQuoted 5 lines
Quoted 1 line
Signed-off-by Dan Carpenter <[email protected]>Thanks for the catch!
Acked-by Kees Cook <[email protected]>
Thanks. Applied.
-Tony