summaryrefslogtreecommitdiffstats
path: root/tools/coccinelle/memset.cocci
blob: 0da576cda68480e20d8a7ec7dba40c89de9c2249 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//

@@
identifier src, dst;
identifier str, len;
type t =~ "struct";

@@

(
- memset(&dst, 0, sizeof(t));
+ memset(&dst, 0, sizeof(dst));
|
- memcpy(&dst, &src, sizeof(t));
+ memcpy(&dst, &src, sizeof(dst));
|
- char str[...];
...
- memset(&str, 0, ...);
+ memset(&str, 0, sizeof(str));
)