cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Elena Reshetova <elena.reshetova@intel.com>
To: Julia.Lawall@lip6.fr
Cc: michal.lkml@markovi.net, keescook@chromium.org,
	Gilles.Muller@lip6.fr, nicolas.palix@imag.fr,
	Dan Carpenter <dan.carpenter@oracle.com>,
	cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH] coccinelle: api/atomic_as_refcounter: Improve verbosity
Date: Thu, 24 Sep 2020 15:22:59 +0300	[thread overview]
Message-ID: <20200924122259.1357095-1-elena.reshetova@intel.com> (raw)

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

                 reply	other threads:[~2020-09-24 12:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200924122259.1357095-1-elena.reshetova@intel.com \
    --to=elena.reshetova@intel.com \
    --cc=Gilles.Muller@lip6.fr \
    --cc=Julia.Lawall@lip6.fr \
    --cc=cocci@systeme.lip6.fr \
    --cc=dan.carpenter@oracle.com \
    --cc=keescook@chromium.org \
    --cc=michal.lkml@markovi.net \
    --cc=nicolas.palix@imag.fr \
    /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).