From cb9f114b3097d49f99a224cd3d2483d106766521 Mon Sep 17 00:00:00 2001 From: David Hildenbrand Date: Tue, 6 May 2025 09:21:24 +0000 Subject: [PATCH V8 4/9] mm/secretmem: use alloc_anon_secure_inode() Use alloc_anon_secure_inode() instead of alloc_anon_inode() + security_inode_init_security_anon() to avoid duplicating the anon_inode_make_secure_inode() logic. Signed-off-by: David Hildenbrand Signed-off-by: Shivank Garg --- mm/secretmem.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/mm/secretmem.c b/mm/secretmem.c index 1b0a214ee558..c0e459e58cb6 100644 --- a/mm/secretmem.c +++ b/mm/secretmem.c @@ -195,18 +195,11 @@ static struct file *secretmem_file_create(unsigned long flags) struct file *file; struct inode *inode; const char *anon_name = "[secretmem]"; - int err; - inode = alloc_anon_inode(secretmem_mnt->mnt_sb); + inode = alloc_anon_secure_inode(secretmem_mnt->mnt_sb, anon_name); if (IS_ERR(inode)) return ERR_CAST(inode); - err = security_inode_init_security_anon(inode, &QSTR(anon_name), NULL); - if (err) { - file = ERR_PTR(err); - goto err_free_inode; - } - file = alloc_file_pseudo(inode, secretmem_mnt, "secretmem", O_RDWR, &secretmem_fops); if (IS_ERR(file)) -- 2.34.1