summaryrefslogtreecommitdiffstats
path: root/tools/coccinelle/cast_to_larger_sizes.cocci
blob: d97e1f9c33df5fdcab1ae87bc1a0153875f71956 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// spatch -sp_file tools/coccinelle/cast_to_larger_sizes.cocci --recursive-includes ./

@r@
typedef uint8_t;
typedef uint16_t;
typedef uint32_t;
typedef uint64_t;
uint8_t *i8;
position p;
@@

 \(
  (uint64_t *) i8@p\|(uint32_t *) i8@p\|(uint16_t *) i8@p
 \)

@script:python@
p << r.p;
@@

coccilib.report.print_report(p[0],"Bad typecast to larger size")