All of lore.kernel.org
 help / color / mirror / Atom feed
* lib/test_fpu.c:66:0-23: WARNING: test_fpu_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE
@ 2020-10-24 20:20 kernel test robot
  2020-10-24 20:20 ` [PATCH] selftests/fpu: fix debugfs_simple_attr.cocci warnings kernel test robot
  0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2020-10-24 20:20 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1096 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Petteri Aimonen <jpa@git.mail.kapsi.fi>
CC: Borislav Petkov <bp@suse.de>
CC: Nick Desaulniers <ndesaulniers@google.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b6f96e75ae121ead54da3f58c545d68184079f90
commit: 4185b3b92792eaec5869266e594338343421ffb0 selftests/fpu: Add an FPU selftest
date:   4 months ago
:::::: branch date: 2 hours ago
:::::: commit date: 4 months ago
config: i386-randconfig-c004-20201023 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


"coccinelle warnings: (new ones prefixed by >>)"
>> lib/test_fpu.c:66:0-23: WARNING: test_fpu_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 40076 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] selftests/fpu: fix debugfs_simple_attr.cocci warnings
  2020-10-24 20:20 lib/test_fpu.c:66:0-23: WARNING: test_fpu_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE kernel test robot
@ 2020-10-24 20:20 ` kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-10-24 20:20 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 1988 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Petteri Aimonen <jpa@git.mail.kapsi.fi>
CC: Borislav Petkov <bp@suse.de>
CC: Nick Desaulniers <ndesaulniers@google.com>
CC: linux-kernel(a)vger.kernel.org

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

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().

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

Fixes: 4185b3b92792 ("selftests/fpu: Add an FPU selftest")
CC: Petteri Aimonen <jpa@git.mail.kapsi.fi>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b6f96e75ae121ead54da3f58c545d68184079f90
commit: 4185b3b92792eaec5869266e594338343421ffb0 selftests/fpu: Add an FPU selftest
:::::: branch date: 2 hours ago
:::::: commit date: 4 months ago

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

 test_fpu.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/lib/test_fpu.c
+++ b/lib/test_fpu.c
@@ -63,7 +63,7 @@ static int test_fpu_get(void *data, u64
 	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;
 }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] selftests/fpu: fix debugfs_simple_attr.cocci warnings
  2020-12-02 16:17 lib/test_fpu.c:66:0-23: WARNING: test_fpu_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE kernel test robot
@ 2020-12-02 16:17 ` kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2020-12-02 16:17 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 2037 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Petteri Aimonen <jpa@git.mail.kapsi.fi>
CC: Borislav Petkov <bp@suse.de>
CC: Nick Desaulniers <ndesaulniers@google.com>
CC: linux-kernel(a)vger.kernel.org

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

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().

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

Fixes: 4185b3b92792 ("selftests/fpu: Add an FPU selftest")
CC: Petteri Aimonen <jpa@git.mail.kapsi.fi>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   509a15421674b9e1a3e1916939d0d0efd3e578da
commit: 4185b3b92792eaec5869266e594338343421ffb0 selftests/fpu: Add an FPU selftest
:::::: branch date: 17 hours ago
:::::: commit date: 5 months ago

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

 test_fpu.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/lib/test_fpu.c
+++ b/lib/test_fpu.c
@@ -63,7 +63,7 @@ static int test_fpu_get(void *data, u64
 	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;
 }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] selftests/fpu: fix debugfs_simple_attr.cocci warnings
@ 2020-10-25 10:20 ` Julia Lawall
  0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2020-10-25 10:20 UTC (permalink / raw)
  To: Petteri Aimonen, Borislav Petkov, Nick Desaulniers
  Cc: nicstange, kbuild-all, linux-kernel, linux-kernel

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

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().

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

Fixes: 4185b3b92792 ("selftests/fpu: Add an FPU selftest")
CC: Petteri Aimonen <jpa@git.mail.kapsi.fi>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b6f96e75ae121ead54da3f58c545d68184079f90
commit: 4185b3b92792eaec5869266e594338343421ffb0 selftests/fpu: Add an FPU selftest
:::::: branch date: 2 hours ago
:::::: commit date: 4 months ago

I don't know much about this issue, but I'm passing the warning along.
The original commit of the semantic patch contains some more information:

    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.

 test_fpu.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/lib/test_fpu.c
+++ b/lib/test_fpu.c
@@ -63,7 +63,7 @@ static int test_fpu_get(void *data, u64
 	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;
 }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] selftests/fpu: fix debugfs_simple_attr.cocci warnings
@ 2020-10-25 10:20 ` Julia Lawall
  0 siblings, 0 replies; 5+ messages in thread
From: Julia Lawall @ 2020-10-25 10:20 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2650 bytes --]

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

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().

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

Fixes: 4185b3b92792 ("selftests/fpu: Add an FPU selftest")
CC: Petteri Aimonen <jpa@git.mail.kapsi.fi>
Signed-off-by: kernel test robot <lkp@intel.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b6f96e75ae121ead54da3f58c545d68184079f90
commit: 4185b3b92792eaec5869266e594338343421ffb0 selftests/fpu: Add an FPU selftest
:::::: branch date: 2 hours ago
:::::: commit date: 4 months ago

I don't know much about this issue, but I'm passing the warning along.
The original commit of the semantic patch contains some more information:

    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.

 test_fpu.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/lib/test_fpu.c
+++ b/lib/test_fpu.c
@@ -63,7 +63,7 @@ static int test_fpu_get(void *data, u64
 	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;
 }

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-12-02 16:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-24 20:20 lib/test_fpu.c:66:0-23: WARNING: test_fpu_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE kernel test robot
2020-10-24 20:20 ` [PATCH] selftests/fpu: fix debugfs_simple_attr.cocci warnings kernel test robot
2020-10-25 10:20 Julia Lawall
2020-10-25 10:20 ` Julia Lawall
2020-12-02 16:17 lib/test_fpu.c:66:0-23: WARNING: test_fpu_fops should be defined with DEFINE_DEBUGFS_ATTRIBUTE kernel test robot
2020-12-02 16:17 ` [PATCH] selftests/fpu: fix debugfs_simple_attr.cocci warnings kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.