cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] [PATCH] coccinelle: api/atomic_as_refcounter: Improve verbosity
@ 2020-09-24 12:22 Elena Reshetova
  0 siblings, 0 replies; only message in thread
From: Elena Reshetova @ 2020-09-24 12:22 UTC (permalink / raw)
  To: Julia.Lawall
  Cc: michal.lkml, keescook, Gilles.Muller, nicolas.palix,
	Dan Carpenter, cocci

When atomic_as_refcounter script is used by 0day CI and
the findings are automatically reported, the message that
it gives is confusing to people. I.e. it does not actually
state what should be done.

Add more information to the message output.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
---
 scripts/coccinelle/api/atomic_as_refcounter.cocci | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/scripts/coccinelle/api/atomic_as_refcounter.cocci b/scripts/coccinelle/api/atomic_as_refcounter.cocci
index 0f78d94abc35..0ce7618479fd 100644
--- a/scripts/coccinelle/api/atomic_as_refcounter.cocci
+++ b/scripts/coccinelle/api/atomic_as_refcounter.cocci
@@ -55,7 +55,8 @@ identifier fname6 =~ ".*call_rcu.*";
 p1 << r1.p1;
 p2 << r1.p2;
 @@
-msg = "atomic_dec_and_test variation before object free at line %s."
+msg = "atomic_dec_and_test variation before object free at line %s. \
+Consider using refcount_t instead of atomic_t for the variable."
 coccilib.report.print_report(p1[0], msg % (p2[0].line))
 
 @r4 exists@
@@ -88,7 +89,8 @@ fname@p2(y, ...);
 p1 << r4.p1;
 p2 << r4.p2;
 @@
-msg = "atomic_dec_and_test variation before object free at line %s."
+msg = "atomic_dec_and_test variation before object free at line %s. \
+Consider using refcount_t instead of atomic_t for the variable."
 coccilib.report.print_report(p1[0], msg % (p2[0].line))
 
 @r2 exists@
@@ -107,7 +109,8 @@ atomic64_add_unless(&(a)->x,-1,1)@p1
 @script:python depends on report@
 p1 << r2.p1;
 @@
-msg = "atomic_add_unless"
+msg = "Usage of atomic_add_unless encountered. \
+Consider using refcount_t instead of atomic_t for the variable."
 coccilib.report.print_report(p1[0], msg)
 
 @r3 exists@
@@ -126,5 +129,6 @@ x = atomic64_add_return@p1(-1, ...);
 @script:python depends on report@
 p1 << r3.p1;
 @@
-msg = "x = atomic_add_return(-1, ...)"
+msg = "Usage of x = atomic_add_return(-1, ...) encountered. \
+Consider using refcount_t instead of atomic_t for the variable."
 coccilib.report.print_report(p1[0], msg)
-- 
2.25.1

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-24 12:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-24 12:22 [Cocci] [PATCH] coccinelle: api/atomic_as_refcounter: Improve verbosity Elena Reshetova

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