cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] Checking for a null pointer with SmPL
@ 2019-06-16 20:07 Markus Elfring
  2019-06-16 20:15 ` Julia Lawall
  0 siblings, 1 reply; 19+ messages in thread
From: Markus Elfring @ 2019-06-16 20:07 UTC (permalink / raw)
  To: Coccinelle

Hello,

A patch on a topic like “staging/rtl8723bs/core/rtw_ap: Remove redundant call
to memset” caught also my software development attention.
https://lkml.org/lkml/2019/6/15/220
https://lore.kernel.org/patchwork/patch/1089416/
https://lore.kernel.org/lkml/20190616033527.GA14062@hari-Inspiron-1545/


The following script for the semantic patch language points the shown
change possibility out as expected.

@display@
expression ex;
identifier zm =~ "_zmalloc";
statement is;
@@
 ex = zm(...);
 if (ex == NULL)
    is

*memset(ex, 0, ...);



I would expect that the following SmPL script can work in a similar way.

@display@
expression ex;
identifier zm =~ "_zmalloc";
statement is, es;
@@
 ex = zm(...);
 if (ex)
    is
 else
    es

*memset(ex, 0, ...);


But this approach does not point an update candidate out at the moment.
How do you think about the software situation?

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

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

end of thread, other threads:[~2019-06-19 11:41 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-16 20:07 [Cocci] Checking for a null pointer with SmPL Markus Elfring
2019-06-16 20:15 ` Julia Lawall
2019-06-17  5:44   ` Markus Elfring
     [not found]     ` <alpine.DEB.2.21.1906170747030.2965@hadrien>
2019-06-17  6:04       ` Markus Elfring
2019-06-17  6:07         ` Julia Lawall
2019-06-17  6:14           ` Markus Elfring
     [not found]             ` <alpine.DEB.2.21.1906170830240.2965@hadrien>
2019-06-17  6:38               ` Markus Elfring
     [not found]                 ` <alpine.DEB.2.20.1906170938530.3699@hadrien>
2019-06-17 16:42                   ` Markus Elfring
2019-06-18  6:33                   ` Markus Elfring
     [not found]                     ` <alpine.DEB.2.20.1906180936090.3707@hadrien>
2019-06-18  8:10                       ` Markus Elfring
2019-06-18 17:27                       ` Markus Elfring
     [not found]                         ` <alpine.DEB.2.20.1906181932030.25567@hadrien>
2019-06-18 18:11                           ` Markus Elfring
2019-06-19  6:11                           ` [Cocci] Handling of pointer expressions by SmPL Markus Elfring
     [not found]                             ` <alpine.DEB.2.21.1906190843070.2687@hadrien>
2019-06-19  7:01                               ` Markus Elfring
2019-06-19  8:11                                 ` Julia Lawall
2019-06-19  8:26                                   ` Markus Elfring
     [not found]                                     ` <alpine.DEB.2.20.1906191223350.3726@hadrien>
2019-06-19 11:20                                       ` Markus Elfring
     [not found]                                         ` <alpine.DEB.2.20.1906191321480.3726@hadrien>
2019-06-19 11:40                                           ` Markus Elfring
2019-06-19 11:40                                           ` Markus Elfring

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