…
> There are a lot of occurences of the panel allocation across the
> subsystem. Much thanks to Maxime for the semanic patch which actually
> gives a list of panels allocated unsafely.

I imagine that the shown SmPL code can be improved another bit
(like the following).


@find_add@
identifier add_f, b, c;
type T;
@@
 add_f(...)
 {
 ... when any
 T *c;
 ... when any
 drm_panel_add(&c->b);
 ... when any
 }

@find_allocation@
identifier alloc_f, cal;
position p;
type find_add.T;
@@
 alloc_f(...)
 {
 ... when any
 T *cal;
 ... when any
 cal =
(      kzalloc
|      devm_kzalloc
)(...)@p;
 ... when any
 }

@script:python@
add_f << find_add.add_f;
alloc_f << find_allocation.alloc_f;
alloc_p << find_allocation.p;
@@
coccilib.report.print_report(alloc_p[0],
                             "ERROR: Panel driver is unsafely allocated in %s 
and added in %s"
                             % (alloc_f, add_f))


Regards,
Markus

Reply via email to