linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "tip-bot2 for kernel test robot" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: kernel test robot <lkp@intel.com>,
	Julia Lawall <julia.lawall@inria.fr>,
	Borislav Petkov <bp@suse.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/misc] selftests/fpu: Fix debugfs_simple_attr.cocci warning
Date: Mon, 18 Jan 2021 11:50:11 -0000	[thread overview]
Message-ID: <161097061196.414.17803528374854236962.tip-bot2@tip-bot2> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2010251117180.2714@hadrien>

The following commit has been merged into the x86/misc branch of tip:

Commit-ID:     443121b3ebb9025fd99ff11851d3537cb756d456
Gitweb:        https://git.kernel.org/tip/443121b3ebb9025fd99ff11851d3537cb756d456
Author:        kernel test robot <lkp@intel.com>
AuthorDate:    Sun, 25 Oct 2020 11:20:04 +01:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Mon, 18 Jan 2021 11:03:26 +01:00

selftests/fpu: Fix debugfs_simple_attr.cocci warning

lib/test_fpu.c:66:0-23: WARNING: test_fpu_fops 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().

In order to protect against file removal races, debugfs files created
via debugfs_create_file() now get wrapped by a struct file_operations
at their opening.

If the original struct file_operations are known to be safe against
removal races by themselves already, the proxy creation may be bypassed
by creating the files through debugfs_create_file_unsafe().

In order to help debugfs users who use the common
DEFINE_SIMPLE_ATTRIBUTE() + debugfs_create_file() idiom to
transition to removal safe struct file_operations, the helper macro
DEFINE_DEBUGFS_ATTRIBUTE() has been introduced.

Thus, the preferred strategy is to use
  DEFINE_DEBUGFS_ATTRIBUTE() + debugfs_create_file_unsafe()
now.

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

Fixes: 4185b3b92792 ("selftests/fpu: Add an FPU selftest")
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/alpine.DEB.2.22.394.2010251117180.2714@hadrien
---
 lib/test_fpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/test_fpu.c b/lib/test_fpu.c
index c33764a..e82db19 100644
--- a/lib/test_fpu.c
+++ b/lib/test_fpu.c
@@ -63,7 +63,7 @@ static int test_fpu_get(void *data, u64 *val)
 	return status;
 }
 
-DEFINE_SIMPLE_ATTRIBUTE(test_fpu_fops, test_fpu_get, NULL, "%lld\n");
+DEFINE_DEBUGFS_ATTRIBUTE(test_fpu_fops, test_fpu_get, NULL, "%lld\n");
 static struct dentry *selftest_dir;
 
 static int __init test_fpu_init(void)
@@ -72,8 +72,8 @@ static int __init test_fpu_init(void)
 	if (!selftest_dir)
 		return -ENOMEM;
 
-	debugfs_create_file("test_fpu", 0444, selftest_dir, NULL,
-			    &test_fpu_fops);
+	debugfs_create_file_unsafe("test_fpu", 0444, selftest_dir, NULL,
+				   &test_fpu_fops);
 
 	return 0;
 }

      reply	other threads:[~2021-01-18 12:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-25 10:20 [PATCH] selftests/fpu: fix debugfs_simple_attr.cocci warnings Julia Lawall
2021-01-18 11:50 ` tip-bot2 for kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=161097061196.414.17803528374854236962.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=bp@suse.de \
    --cc=julia.lawall@inria.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).