[PATCH] fix err_cast.cocci warnings

kernel test robot lkp at intel.com
Thu Jun 4 11:19:49 UTC 2020


From: kernel test robot <lkp at intel.com>

fs/anon_inodes.c:92:10-17: WARNING: ERR_CAST can be used with inode


 Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))

Generated by: scripts/coccinelle/api/err_cast.cocci

Fixes: 2749d3f84a70 ("Add a new LSM-supporting anonymous inode interface")
CC: Daniel Colascione <dancol at google.com>
Signed-off-by: kernel test robot <lkp at intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git secure_uffd_v5.9
head:   d08ac70b1e0dc71ac2315007bcc3efb283b2eae4
commit: 2749d3f84a708110ed0359579be0eddd2c4036da [1/3] Add a new LSM-supporting anonymous inode interface

 anon_inodes.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -89,7 +89,7 @@ struct file *_anon_inode_getfile(const c
 		inode =	anon_inode_make_secure_inode(
 			name, context_inode);
 		if (IS_ERR(inode))
-			return ERR_PTR(PTR_ERR(inode));
+			return ERR_CAST(inode);
 	} else {
 		inode =	anon_inode_inode;
 		if (IS_ERR(inode))



More information about the Linux-security-module-archive mailing list