CC: [email protected]
CC: Linux Memory Management List <[email protected]>
TO: Michael Ellerman <[email protected]>
CC: Benjamin Herrenschmidt <[email protected]>
CC: Paul Mackerras <[email protected]>
CC: Nicholas Piggin <[email protected]>
CC: Jordan Niethe <[email protected]>
CC: Alistair Popple <[email protected]>
CC: Gustavo Walbon <[email protected]>
CC: [email protected]
CC: [email protected]

From: kernel test robot <[email protected]>

arch/powerpc/kernel/security.c:807:0-23: WARNING: fops_entry_flush should be 
defined with DEFINE_DEBUGFS_ATTRIBUTE
arch/powerpc/kernel/security.c:781:0-23: WARNING: fops_rfi_flush should be 
defined with DEFINE_DEBUGFS_ATTRIBUTE
arch/powerpc/kernel/security.c:833:0-23: WARNING: fops_uaccess_flush should be 
defined with DEFINE_DEBUGFS_ATTRIBUTE

 Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE
 for debugfs files.

Semantic patch information:
 Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
 imposes some significant overhead as compared to
 DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Fixes: c6b4c9147f8b ("powerpc/64: Move security code into security.c")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: kernel test robot <[email protected]>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   e99d8a8495175df8cb8b739f8cf9b0fc9d0cd3b5
commit: c6b4c9147f8b85d159f670d7bce71a93d16062a2 [11082/11648] powerpc/64: Move 
security code into security.c
:::::: branch date: 5 hours ago
:::::: commit date: 29 hours ago

Please take the patch only if it's a positive warning. Thanks!

 security.c |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

--- a/arch/powerpc/kernel/security.c
+++ b/arch/powerpc/kernel/security.c
@@ -778,7 +778,8 @@ static int rfi_flush_get(void *data, u64
        return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_rfi_flush, rfi_flush_get, rfi_flush_set, 
"%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_rfi_flush, rfi_flush_get, rfi_flush_set,
+                        "%llu\n");
 
 static int entry_flush_set(void *data, u64 val)
 {
@@ -804,7 +805,8 @@ static int entry_flush_get(void *data, u
        return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_entry_flush, entry_flush_get, entry_flush_set, 
"%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_entry_flush, entry_flush_get, entry_flush_set,
+                        "%llu\n");
 
 static int uaccess_flush_set(void *data, u64 val)
 {
@@ -830,13 +832,18 @@ static int uaccess_flush_get(void *data,
        return 0;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(fops_uaccess_flush, uaccess_flush_get, 
uaccess_flush_set, "%llu\n");
+DEFINE_DEBUGFS_ATTRIBUTE(fops_uaccess_flush, uaccess_flush_get,
+                        uaccess_flush_set, "%llu\n");
 
 static __init int rfi_flush_debugfs_init(void)
 {
-       debugfs_create_file("rfi_flush", 0600, powerpc_debugfs_root, NULL, 
&fops_rfi_flush);
-       debugfs_create_file("entry_flush", 0600, powerpc_debugfs_root, NULL, 
&fops_entry_flush);
-       debugfs_create_file("uaccess_flush", 0600, powerpc_debugfs_root, NULL, 
&fops_uaccess_flush);
+       debugfs_create_file_unsafe("rfi_flush", 0600, powerpc_debugfs_root,
+                                  NULL, &fops_rfi_flush);
+       debugfs_create_file_unsafe("entry_flush", 0600, powerpc_debugfs_root,
+                                  NULL, &fops_entry_flush);
+       debugfs_create_file_unsafe("uaccess_flush", 0600,
+                                  powerpc_debugfs_root, NULL,
+                                  &fops_uaccess_flush);
        return 0;
 }
 device_initcall(rfi_flush_debugfs_init);
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to