From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============0611873630442313537==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] powerpc/64: fix debugfs_simple_attr.cocci warnings Date: Mon, 13 Sep 2021 18:22:04 +0800 Message-ID: <20210913102204.GA51891@6eaede2afa3f> In-Reply-To: <202109131810.EkD971rx-lkp@intel.com> List-Id: To: kbuild@lists.01.org --===============0611873630442313537== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: Michael Ellerman CC: Benjamin Herrenschmidt CC: Paul Mackerras CC: Nicholas Piggin CC: linuxppc-dev(a)lists.ozlabs.org CC: linux-kernel(a)vger.kernel.org From: kernel test robot arch/powerpc/kernel/security.c:807:0-23: WARNING: fops_entry_flush should b= e 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 Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = master head: 6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f commit: c6b4c9147f8b85d159f670d7bce71a93d16062a2 powerpc/64: Move security = code into security.c :::::: branch date: 11 hours ago :::::: commit date: 5 months ago Please take the patch only if it's a positive warning. Thanks! security.c | 18 ++++++++++++------ 1 file changed, 12 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, "%ll= u\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_se= t, + "%llu\n"); = static int uaccess_flush_set(void *data, u64 val) { @@ -830,13 +832,17 @@ static int uaccess_flush_get(void *data, return 0; } = -DEFINE_SIMPLE_ATTRIBUTE(fops_uaccess_flush, uaccess_flush_get, uaccess_flu= sh_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, arch_debugfs_dir, NULL, &fops_rfi_= flush); - debugfs_create_file("entry_flush", 0600, arch_debugfs_dir, NULL, &fops_en= try_flush); - debugfs_create_file("uaccess_flush", 0600, arch_debugfs_dir, NULL, &fops_= uaccess_flush); + debugfs_create_file_unsafe("rfi_flush", 0600, arch_debugfs_dir, NULL, + &fops_rfi_flush); + debugfs_create_file_unsafe("entry_flush", 0600, arch_debugfs_dir, + NULL, &fops_entry_flush); + debugfs_create_file_unsafe("uaccess_flush", 0600, arch_debugfs_dir, + NULL, &fops_uaccess_flush); return 0; } device_initcall(rfi_flush_debugfs_init); --===============0611873630442313537==--