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

Reply via email to