add smatch_scripts/filter_kernel_deref_check.sh
[smatch.git] / smatch_scripts / filter_kernel_deref_check.sh
blob39067c0d2f4452c290b5a13fcceea410bd7bd695
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 ' ' -f2)
16 variable=$(echo "$line" | cut -d "'" -f2)
17 source_line=$(tail -n $lineno $code_file | head -n 1 | sed -e 's/^\W*//')
19 if echo "$source_line" | grep -q rcu_assign_pointer ; then
20 continue
22 if echo "$source_line" | grep -q '^\W*tda_' ; then
23 continue
25 if echo "$source_line" | grep -q tda_fail ; then
26 continue
28 if echo "$source_line" | grep -q '^\W*ATH5K_' ; then
29 continue
31 if echo "$source_line" | grep -qw CMDINFO ; then
32 continue
34 if echo "$source_line" | grep -qw dump_desc_dbg ; then
35 continue
37 if echo "$source_line" | grep -qw CAMERA_IS_OPERATIONAL ; then
38 continue
40 if echo "$source_line" | grep -qw USBVISION_IS_OPERATIONAL ; then
41 continue
43 if echo "$source_line" | grep -qw DEV_INIT_TEST_WITH_RETURN ; then
44 continue
46 if echo "$source_line" | grep -qw TW_PRINTK ; then
47 continue
49 if echo "$source_line" | grep -qw RESET_ONE_SEC_TX_CNT ; then
50 continue
52 if echo "$source_line" | grep -qw SOCK_DEBUG; then
53 continue
55 if echo "$source_line" | grep -qw P80211SKB_RXMETA ; then
56 continue
58 if echo "$source_line" | grep -qw ACM_READY ; then
59 continue
61 if echo "$source_line" | grep -qw v4l2_subdev_notify ; then
62 continue
64 if echo "$source_line" | egrep -qw 'tuner_(err|info)' ; then
65 continue
67 if echo "$source_line" | grep -qw DBG_SKB ; then
68 continue
70 if echo "$source_line" | grep -qw for_each_mddev ; then
71 continue
73 if echo "$source_line" | grep -qw v4l2_subdev_call ; then
74 continue
76 if echo "$source_line" | grep -qw VALID_CALLBACK ; then
77 continue
79 if [ "$variable" == "bp->dev" ] && echo "$source_line" | grep -qw DP ; then
80 continue
82 if echo "$source_line" | grep -qw BNX2X_ERR ; then
83 continue
85 if echo "$source_line" | grep -qw FCOE_NETDEV_DBG ; then
86 continue
88 if echo "$source_line" | grep -qw __rq_for_each_bio ; then
89 continue
91 if echo "$source_line" | grep -qw IPS_DMA_DIR ; then
92 continue
94 if [ "$variable" == "dev" ] && echo "$source_line" | grep -qw dprintk ; then
95 continue
98 echo "$code_file $lineno '$variable': $source_line"
99 done