kernel: move stuff from check_kernel.c to db/fixup_kernel.sh
[smatch.git] / smatch_data / db / fixup_kernel.sh
blob520a797995f91ce36acfa72cdbda1bca9486f0b3
1 #!/bin/bash
3 # mark some paramaters as coming from user space
4 cat << EOF | sqlite3 smatch_db.sqlite
5 insert into caller_info values ('userspace', '', 'compat_sys_ioctl', 0, 0, 3, 0, '$$', '1');
6 insert into caller_info values ('userspace', '', 'compat_sys_ioctl', 0, 0, 3, 1, '$$', '1');
7 insert into caller_info values ('userspace', '', 'compat_sys_ioctl', 0, 0, 3, 2, '$$', '1');
9 delete from caller_info where function = '(struct file_operations)->read' and file != 'fs/read_write.c';
10 delete from caller_info where function = '(struct file_operations)->write' and file != 'fs/read_write.c';
12 delete from caller_info where function = '(struct notifier_block)->notifier_call' and type != 0;
13 delete from caller_info where function = '(struct mISDNchannel)->send' and type != 0;
15 delete from caller_info where caller = 'hid_input_report' and type = 3;
16 delete from caller_info where caller = 'nes_process_iwarp_aeqe' and type = 3;
17 delete from caller_info where caller = 'oz_process_ep0_urb' and type = 3;
18 delete from caller_info where function = 'dev_hard_start_xmit' and key = '\$\$' and type = 3;
19 delete from caller_info where function like '%->ndo_start_xmit' and key = '\$\$' and type = 3;
20 delete from caller_info where caller = 'packet_rcv_fanout' and function = '(struct packet_type)->func' and parameter = 1 and type = 3;
22 delete from caller_info where caller = 'hptiop_probe' and type = 3;
24 delete from caller_info where function = '(struct timer_list)->function' and parameter = 0;
26 delete from return_states where function = 'rw_verify_area';
27 insert into return_states values ('faked', 'rw_verify_area', 0, 1, '0-1000000', 0, 0, -1, '', '');
28 insert into return_states values ('faked', 'rw_verify_area', 0, 1, '0-1000000', 0, 11, 2, '*\$\$', '0-1000000');
29 insert into return_states values ('faked', 'rw_verify_area', 0, 1, '0-1000000', 0, 11, 3, '\$\$', '0-1000000');
30 insert into return_states values ('faked', 'rw_verify_area', 0, 2, '(-4095)-(-1)', 0, 0, -1, '', '');
32 update return_states set return = '0-u32max[<=p2]' where function = 'copy_to_user';
33 update return_states set return = '0-u32max[<=p2]' where function = '_copy_to_user';
34 update return_states set return = '0-u32max[<=p2]' where function = '__copy_to_user';
35 update return_states set return = '0-u32max[<=p2]' where function = 'copy_from_user';
36 update return_states set return = '0-u32max[<=p2]' where function = '_copy_from_user';
37 update return_states set return = '0-u32max[<=p2]' where function = '__copy_from_user';
39 EOF
41 call_id=$(echo "select distinct call_id from caller_info where function = '__kernel_write';" | sqlite3 smatch_db.sqlite)
42 for id in $call_id ; do
43 echo "insert into caller_info values ('fake', '', '__kernel_write', $id, 0, 1, 3, '*\$\$', '0-1000000');" | sqlite3 smatch_db.sqlite
44 done
46 for i in $(echo "select distinct return from return_states where function = 'clear_user';" | sqlite3 smatch_db.sqlite ) ; do
47 echo "update return_states set return = \"$i[<=p1]\" where return = \"$i\" and function = 'clear_user';" | sqlite3 smatch_db.sqlite
48 done