db: kernel: ignore i40e_dbg_netdev_ops_write()
[smatch.git] / smatch_data / db / fixup_kernel.sh
blob44150287f72b06caac1fd2d25c4248754500c1d6
1 #!/bin/bash
3 # mark some paramaters as coming from user space
4 cat << EOF | sqlite3 smatch_db.sqlite
5 /* we only care about the main ->read/write() functions. */
6 delete from caller_info where function = '(struct file_operations)->read' and file != 'fs/read_write.c';
7 delete from caller_info where function = '(struct file_operations)->write' and file != 'fs/read_write.c';
8 delete from function_ptr where function = '(struct file_operations)->read';
9 delete from function_ptr where function = '(struct file_operations)->write';
11 /* delete these function pointers which cause false positives */
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;
14 delete from caller_info where function = '(struct irq_router)->get' and type != 0;
15 delete from caller_info where function = '(struct irq_router)->set' and type != 0;
16 delete from caller_info where function = '(struct net_device_ops)->ndo_change_mtu' and caller = 'i40e_dbg_netdev_ops_write';
18 /* type 3 is USER_DATA */
19 delete from caller_info where caller = 'hid_input_report' and type = 3;
20 delete from caller_info where caller = 'nes_process_iwarp_aeqe' and type = 3;
21 delete from caller_info where caller = 'oz_process_ep0_urb' and type = 3;
22 delete from caller_info where function = 'dev_hard_start_xmit' and key = '\$\$' and type = 3;
23 delete from caller_info where function like '%->ndo_start_xmit' and key = '\$\$' and type = 3;
24 delete from caller_info where caller = 'packet_rcv_fanout' and function = '(struct packet_type)->func' and parameter = 1 and type = 3;
25 delete from caller_info where caller = 'hptiop_probe' and type = 3;
27 insert into caller_info values ('userspace', '', 'compat_sys_ioctl', 0, 0, 3, 0, '$$', '1');
28 insert into caller_info values ('userspace', '', 'compat_sys_ioctl', 0, 0, 3, 1, '$$', '1');
29 insert into caller_info values ('userspace', '', 'compat_sys_ioctl', 0, 0, 3, 2, '$$', '1');
31 delete from caller_info where function = '(struct timer_list)->function' and parameter = 0;
34 * rw_verify_area is a very central function for the kernel. The 1000000 isn't
35 * accurate but I've picked it so that we can add "pos + count" without wrapping
36 * on 32 bits.
38 delete from return_states where function = 'rw_verify_area';
39 insert into return_states values ('faked', 'rw_verify_area', 0, 1, '0-1000000[<=p3]', 0, 0, -1, '', '');
40 insert into return_states values ('faked', 'rw_verify_area', 0, 1, '0-1000000[<=p3]', 0, 11, 2, '*\$\$', '0-1000000');
41 insert into return_states values ('faked', 'rw_verify_area', 0, 1, '0-1000000[<=p3]', 0, 11, 3, '\$\$', '0-1000000');
42 insert into return_states values ('faked', 'rw_verify_area', 0, 2, '(-4095)-(-1)', 0, 0, -1, '', '');
45 /* store a bunch of capped functions */
46 update return_states set return = '0-u32max[<=p2]' where function = 'copy_to_user';
47 update return_states set return = '0-u32max[<=p2]' where function = '_copy_to_user';
48 update return_states set return = '0-u32max[<=p2]' where function = '__copy_to_user';
49 update return_states set return = '0-u32max[<=p2]' where function = 'copy_from_user';
50 update return_states set return = '0-u32max[<=p2]' where function = '_copy_from_user';
51 update return_states set return = '0-u32max[<=p2]' where function = '__copy_from_user';
53 EOF
55 call_id=$(echo "select distinct call_id from caller_info where function = '__kernel_write';" | sqlite3 smatch_db.sqlite)
56 for id in $call_id ; do
57 echo "insert into caller_info values ('fake', '', '__kernel_write', $id, 0, 1, 3, '*\$\$', '0-1000000');" | sqlite3 smatch_db.sqlite
58 done
60 for i in $(echo "select distinct return from return_states where function = 'clear_user';" | sqlite3 smatch_db.sqlite ) ; do
61 echo "update return_states set return = \"$i[<=p1]\" where return = \"$i\" and function = 'clear_user';" | sqlite3 smatch_db.sqlite
62 done