From: Denis Efremov <efremov@linux.com>
To: Coccinelle <cocci@systeme.lip6.fr>
Subject: [Cocci] How to match function-like macro calls, e.g. RTA_ALIGN(rta->rta_len)?
Date: Mon, 11 Jan 2021 23:06:12 +0300 [thread overview]
Message-ID: <854fdad7-cf2d-49d8-571c-1ac64fa90fb6@linux.com> (raw)
Hi,
Let's suppose I want to match otx_cpt_aead_cbc_aes_sha_setkey() function from
drivers/crypto/marvell/octeontx/otx_cptvf_algs.c file (linux kernel).
My pattern:
@exists@
identifier rta, param, key, keylen;
position p;
@@
otx_cpt_aead_cbc_aes_sha_setkey(...,
unsigned char *key, unsigned int keylen)
{
...
* if (RTA_PAYLOAD(rta) < sizeof(*param))@p
goto badkey;
...
* key += RTA_ALIGN(rta->rta_len);
* keylen -= RTA_ALIGN(rta->rta_len);
...
}
$ spatch --no-includes --include-headers --cocci-file test.cocci drivers/crypto/marvell/octeontx/otx_cptvf_algs.c
init_defs_builtins: /usr/lib64/coccinelle/standard.h
minus: parse error:
File "test.cocci", line 13, column 9, charpos = 219
around = 'RTA_ALIGN',
whole content = * key += RTA_ALIGN(rta->rta_len);
What can I do to match RTA_ALIGN(...) lines?
Thanks,
Denis
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next reply other threads:[~2021-01-11 20:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-11 20:06 Denis Efremov [this message]
2021-01-11 20:23 ` [Cocci] How to match function-like macro calls, e.g. RTA_ALIGN(rta->rta_len)? Julia Lawall
2021-01-11 20:32 ` Denis Efremov
2021-01-11 20:40 ` Julia Lawall
2021-01-11 20:49 ` Denis Efremov
2021-01-11 20:59 ` Julia Lawall
2021-01-11 21:12 ` Denis Efremov
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=854fdad7-cf2d-49d8-571c-1ac64fa90fb6@linux.com \
--to=efremov@linux.com \
--cc=cocci@systeme.lip6.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 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.