cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] How to match function-like macro calls, e.g. RTA_ALIGN(rta->rta_len)?
@ 2021-01-11 20:06 Denis Efremov
  2021-01-11 20:23 ` Julia Lawall
  0 siblings, 1 reply; 7+ messages in thread
From: Denis Efremov @ 2021-01-11 20:06 UTC (permalink / raw)
  To: Coccinelle

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

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

end of thread, other threads:[~2021-01-11 21:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 20:06 [Cocci] How to match function-like macro calls, e.g. RTA_ALIGN(rta->rta_len)? Denis Efremov
2021-01-11 20:23 ` 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

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