smatch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
To: smatch@vger.kernel.org
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Subject: [PATCH] check_bogus_irqrestore: Preparation work in order to add more functions
Date: Thu, 26 May 2022 07:15:05 +0200	[thread overview]
Message-ID: <2288d268fc3a163f03cd92c2b1778f6f2e9f83d0.1653542090.git.christophe.jaillet@wanadoo.fr> (raw)

The fact that the 'flag' parameter is the 2nd one when
spin_unlock_irqrestore() is used is hard coded.

Pass this information via the last argument of add_function_hook().

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 check_bogus_irqrestore.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/check_bogus_irqrestore.c b/check_bogus_irqrestore.c
index c47077a2f5ca..6c2b5cc17c86 100644
--- a/check_bogus_irqrestore.c
+++ b/check_bogus_irqrestore.c
@@ -19,12 +19,13 @@
 
 static int my_id;
 
-static void match_irqrestore(const char *fn, struct expression *expr, void *data)
+static void match_irqrestore(const char *fn, struct expression *expr, void *_arg_nr)
 {
+	int arg_nr = PTR_INT(_arg_nr);
 	struct expression *arg_expr;
 	sval_t tmp;
 
-	arg_expr = get_argument_from_call_expr(expr->args, 1);
+	arg_expr = get_argument_from_call_expr(expr->args, arg_nr);
 	if (!get_implied_value(arg_expr, &tmp))
 		return;
 	sm_error("calling '%s()' with bogus flags", fn);
@@ -36,5 +37,5 @@ void check_bogus_irqrestore(int id)
 		return;
 
 	my_id = id;
-	add_function_hook("spin_unlock_irqrestore", &match_irqrestore, NULL);
+	add_function_hook("spin_unlock_irqrestore", &match_irqrestore, INT_PTR(1));
 }
-- 
2.34.1

                 reply	other threads:[~2022-05-26  5:15 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=2288d268fc3a163f03cd92c2b1778f6f2e9f83d0.1653542090.git.christophe.jaillet@wanadoo.fr \
    --to=christophe.jaillet@wanadoo.fr \
    --cc=smatch@vger.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 read-only IMAP folder(s) and NNTP newsgroup(s).