expressions: make assign_expression() take an op argument
[smatch.git] / smatch_scripts / filter_kernel_deref_check.sh
blobc70d7994ead9d049911480bf6f99fbda3bef2362
1 #!/bin/bash
3 file=$1
4 if [[ "$file" = "" ]] ; then
5 echo "Usage: $0 <file with smatch messages>"
6 exit 1
7 fi
9 IFS="
12 for line in $(grep 'dereferenced before' $file) ; do
14 code_file=$(echo "$line" | cut -d ':' -f1)
15 lineno=$(echo "$line" | cut -d ' ' -f1 | cut -d ':' -f2)
16 function=$(echo "$line" | cut -d ' ' -f2)
17 variable=$(echo "$line" | cut -d "'" -f3)
18 source_line=$(tail -n +$lineno $code_file | head -n 1 | sed -e 's/^\W*//')
20 if echo "$source_line" | grep -q rcu_assign_pointer ; then
21 continue
23 if echo "$source_line" | grep -q '^\W*tda_' ; then
24 continue
26 if echo "$source_line" | grep -q tda_fail ; then
27 continue
29 if echo "$source_line" | grep -q '^\W*ATH5K_' ; then
30 continue
32 if echo "$source_line" | grep -qw CMDINFO ; then
33 continue
35 if echo "$source_line" | grep -qw dump_desc_dbg ; then
36 continue
38 if echo "$source_line" | grep -qw CAMERA_IS_OPERATIONAL ; then
39 continue
41 if echo "$source_line" | grep -qw USBVISION_IS_OPERATIONAL ; then
42 continue
44 if echo "$source_line" | grep -qw DEV_INIT_TEST_WITH_RETURN ; then
45 continue
47 if echo "$source_line" | grep -qw TW_PRINTK ; then
48 continue
50 if echo "$source_line" | grep -qw RESET_ONE_SEC_TX_CNT ; then
51 continue
53 if echo "$source_line" | grep -qw SOCK_DEBUG; then
54 continue
56 if echo "$source_line" | grep -qw P80211SKB_RXMETA ; then
57 continue
59 if echo "$source_line" | grep -qw ACM_READY ; then
60 continue
62 if echo "$source_line" | grep -qw v4l2_subdev_notify ; then
63 continue
65 if echo "$source_line" | egrep -qw 'tuner_(err|info)' ; then
66 continue
68 if echo "$source_line" | grep -qw DBG_SKB ; then
69 continue
71 if echo "$source_line" | grep -qw for_each_mddev ; then
72 continue
74 if echo "$source_line" | grep -qw v4l2_subdev_call ; then
75 continue
77 if echo "$source_line" | grep -qw VALID_CALLBACK ; then
78 continue
80 if [ "$variable" == "bp->dev" ] && echo "$source_line" | grep -qw DP ; then
81 continue
83 if echo "$source_line" | grep -qw BNX2X_ERR ; then
84 continue
86 if echo "$source_line" | grep -qw FCOE_NETDEV_DBG ; then
87 continue
89 if echo "$source_line" | grep -qw __rq_for_each_bio ; then
90 continue
92 if echo "$source_line" | grep -qw IPS_DMA_DIR ; then
93 continue
95 if [ "$variable" == "dev" ] && echo "$source_line" | grep -qw dprintk ; then
96 continue
99 echo "$code_file:$lineno $function '$variable': $source_line"
100 done