Coccinelle archive on lore.kernel.org
 help / color / Atom feed
* [Cocci] Checking data processing results for a special SmPL disjunction
@ 2020-06-27  8:42 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2020-06-27  8:42 UTC (permalink / raw)
  To: Coccinelle

Hello,

I have tried another tiny script variant out for the semantic patch language
(according to the software combination “Coccinelle 1.0.8-00131-g675b9670”).

@display@
expression* pointer;
identifier result;
type t;
@@
 t result = <+...
(           sizeof(*(pointer))
|
*           *(pointer)
)           ...+>;


elfring@Sonne:~/Projekte/Linux/next-patched> spatch ~/Projekte/Coccinelle/janitor/show_interesting_disjunction-20200627.cocci drivers/base/regmap/regmap.c
…
@@ -1263,7 +1261,6 @@ EXPORT_SYMBOL_GPL(devm_regmap_field_free
 struct regmap_field *regmap_field_alloc(struct regmap *regmap,
 		struct reg_field reg_field)
 {
-	struct regmap_field *rm_field = kzalloc(sizeof(*rm_field), GFP_KERNEL);

 	if (!rm_field)
 		return ERR_PTR(-ENOMEM);


Now I wonder why such a diff hunk is generated.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/regmap/regmap.c?id=95b2c3ec4cb1689db2389c251d39f64490ba641c#n1254
https://elixir.bootlin.com/linux/v5.7.2/source/drivers/base/regmap/regmap.c#L1261

I expected that the first element in the shown SmPL disjunction
should exclude displays for the usage of the operator “sizeof”.
Is my understanding still incomplete also for this software behaviour?

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

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

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27  8:42 [Cocci] Checking data processing results for a special SmPL disjunction Markus Elfring

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr
	public-inbox-index cocci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git