Line data Source code
1 :
2 : struct device;
3 :
4 : void *ldv_dev_get_drvdata(const struct device *dev);
5 : int ldv_dev_set_drvdata(struct device *dev, void *data);
6 :
7 : struct spi_master;
8 : struct device;
9 : struct spi_master *ldv_spi_alloc_master(struct device *host, unsigned size);
10 :
11 : #include <linux/ldv/err.h>
12 :
13 : #include <linux/types.h>
14 : void *ldv_kzalloc(size_t size, gfp_t flags);
15 :
16 : struct clk;
17 :
18 : extern void ldv_clk_disable(struct clk *clk);
19 : extern int ldv_clk_enable(void);
20 :
21 : #include <linux/ldv/common.h>
22 : #include <linux/ldv/irq.h>
23 : #include <verifier/common.h>
24 : #include <verifier/nondet.h>
25 : #include <verifier/memory.h>
26 : #include <verifier/thread.h>
27 :
28 : #include <linux/cdev.h>
29 : #include <linux/miscdevice.h>
30 : #include <linux/fs.h>
31 : #include <linux/pagemap.h>
32 :
33 :
34 : struct ldv_struct_insmod_10 {
35 : int signal_pending;
36 : };
37 :
38 : struct ldv_struct_random_containerless_scenario_9 {
39 : struct file_system_type *arg0;
40 : int signal_pending;
41 : };
42 :
43 : /* EMG Function declarations */
44 : void ldv_character_driver_scenario_1(void *);
45 : void ldv_character_driver_scenario_callback_1_22(int (*)(struct file *, void *, filldir_t ), struct file *, void *, int (*)(void *, char *, int, loff_t , u64 , unsigned int));
46 : void ldv_character_driver_scenario_callback_1_5(ssize_t (*)(struct file *, char *, long unsigned int, loff_t *), struct file *, char *, long unsigned int, loff_t *);
47 : extern int ldv_character_driver_scenario_probe_1_13(int (*)(struct inode *, struct file *), struct inode *, struct file *);
48 : extern void ldv_character_driver_scenario_write_1_4(ssize_t (*)(struct file *, char *, long unsigned int, loff_t *), struct file *, char *, long unsigned int, loff_t *);
49 : void ldv_random_containerless_scenario_callback_8_4(struct dentry *(*)(struct inode *, struct dentry *, struct nameidata *), struct inode *, struct dentry *, struct nameidata *);
50 :
51 : /* EMG variable declarations */
52 1 : struct ldv_thread ldv_thread_1;
53 :
54 : /* EMG variable initialization */
55 :
56 : /* EMG function definitions */
57 : /* AUX_FUNC ldv_character_driver_scenario_1 */
58 : void ldv_character_driver_scenario_1(void *arg0) {
59 : /* LDV {"thread": 1, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'character_driver_scenario(file_operations)'", "function": "ldv_character_driver_scenario_1"} */
60 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
61 1 : ssize_t (*ldv_1_callback_read)(struct file *, char *, long unsigned int, loff_t *);
62 : int (*ldv_1_callback_readdir)(struct file *, void *, filldir_t );
63 : struct file_operations *ldv_1_container_file_operations;
64 1 : char *ldv_1_ldv_param_4_1_default;
65 1 : long long int *ldv_1_ldv_param_4_3_default;
66 1 : char *ldv_1_ldv_param_5_1_default;
67 1 : long long int *ldv_1_ldv_param_5_3_default;
68 1 : struct file *ldv_1_resource_file;
69 1 : struct inode *ldv_1_resource_inode;
70 1 : int ldv_1_ret_default;
71 1 : int (*ldv_1_size_cnt_func_1_ptr)(void *, char *, int, loff_t , u64 , unsigned int);
72 1 : long unsigned int ldv_1_size_cnt_write_size;
73 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
74 1 : /* Initialize automaton variables */
75 2 : ldv_1_ret_default = 1;
76 1 : /* LDV {"action": "DEFAULT_REGISTER_1", "type": "RECEIVE_BEGIN", "comment": "Begin FILE_OPERATIONS callbacks invocations scenario."} */
77 3 : ldv_free(arg0);
78 1 : /* LDV {"action": "DEFAULT_REGISTER_1", "type": "RECEIVE_END"} */
79 1 :
80 1 : /* LDV {"action": "DEFAULT_ALLOC_1", "type": "CONDITION_BEGIN", "comment": "Allocate memory after default registration."} */
81 4 : ldv_1_container_file_operations = ldv_xmalloc_unknown_size(0);
82 1 : /* LDV {"action": "DEFAULT_ALLOC_1", "type": "CONDITION_END"} */
83 1 :
84 1 : /* LDV {"action": "INIT", "type": "CONDITION_BEGIN", "comment": "Allocate memory for file and inode structures."} */
85 4 : ldv_1_resource_file = ldv_xmalloc(sizeof(struct file));
86 3 : ldv_1_resource_inode = ldv_xmalloc(sizeof(struct inode));
87 3 : ldv_1_size_cnt_func_1_ptr = ldv_undef_int();
88 : /* LDV {"action": "INIT", "type": "CONDITION_END"} */
89 :
90 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Device appeared in the system."} */
91 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
92 :
93 : /* Jump to a subprocess 'main' initial state */
94 1 : goto ldv_main_1;
95 : /* End of the process */
96 : return;
97 1 :
98 : /* Sbprocess main */
99 : ldv_main_1:
100 : /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
101 :
102 4 : if (ldv_undef_int()) {
103 : /* LDV {"action": "PROBE", "type": "CALL_BEGIN", "callback": true, "comment": "Open the device file. Invoke callback probe from FILE_OPERATIONS."} */
104 3 : if (ldv_1_container_file_operations->open) {
105 : /* LDV {"type": "CALLBACK", "call": "ldv_1_ret_default = (ldv_1_container_file_operations->open)(ldv_1_resource_inode, ldv_1_resource_file);", "comment": "probe"} */
106 2 : ldv_1_ret_default = ldv_character_driver_scenario_probe_1_13(ldv_1_container_file_operations->open, ldv_1_resource_inode, ldv_1_resource_file);
107 : }
108 : /* Callback post-call */
109 4 : ldv_1_ret_default = ldv_filter_err_code(ldv_1_ret_default);
110 : /* LDV {"action": "PROBE", "type": "CALL_END"} */
111 :
112 4 : if (ldv_undef_int()) {
113 : /* LDV {"action": "PROBE_SUCCESS", "type": "CONDITION_BEGIN", "comment": "Device file is opened successfully."} */
114 2 : ldv_assume(ldv_1_ret_default == 0);
115 : /* LDV {"action": "PROBE_SUCCESS", "type": "CONDITION_END"} */
116 :
117 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Device file is opened, ready to read and write."} */
118 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
119 :
120 : /* Jump to a subprocess 'call' initial state */
121 1 : goto ldv_call_1;
122 : }
123 : else {
124 : /* LDV {"action": "PROBE_FAIL", "type": "CONDITION_BEGIN", "comment": "Failed to open devices file."} */
125 2 : ldv_assume(ldv_1_ret_default != 0);
126 : /* LDV {"action": "PROBE_FAIL", "type": "CONDITION_END"} */
127 :
128 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Device appeared in the system."} */
129 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
130 :
131 : /* Jump to a subprocess 'main' initial state */
132 1 : goto ldv_main_1;
133 : }
134 : }
135 : else {
136 : /* LDV {"action": "FREE", "type": "CONDITION_BEGIN", "comment": "Free memory of file and inode structures."} */
137 2 : ldv_free(ldv_1_resource_file);
138 2 : ldv_free(ldv_1_resource_inode);
139 : /* LDV {"action": "FREE", "type": "CONDITION_END"} */
140 :
141 : /* LDV {"action": "DEFAULT_FREE_1", "type": "CONDITION_BEGIN", "comment": "Free memory before default deregistration."} */
142 2 : ldv_free(ldv_1_container_file_operations);
143 : /* LDV {"action": "DEFAULT_FREE_1", "type": "CONDITION_END"} */
144 :
145 : /* LDV {"action": "DEFAULT_DEREGISTER_1", "type": "RECEIVE_BEGIN", "comment": "Finish FILE_OPERATIONS callbacks invocations scenario."} */
146 : /* Skip a non-replicative signal receiving */
147 : /* LDV {"action": "DEFAULT_DEREGISTER_1", "type": "RECEIVE_END"} */
148 :
149 : /* Exit function at a terminal state */
150 1 : return;
151 : }
152 : /* End of the subprocess 'main' */
153 : return;
154 1 :
155 : /* Sbprocess call */
156 : ldv_call_1:
157 : /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
158 :
159 2 : switch (ldv_undef_int()) {
160 3 : case 1: {
161 : /* LDV {"action": "PRE_CALL_4", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
162 3 : ldv_1_ldv_param_4_1_default = ldv_xmalloc_unknown_size(0);
163 3 : ldv_1_ldv_param_4_3_default = ldv_xmalloc_unknown_size(0);
164 : /* LDV {"action": "PRE_CALL_4", "type": "CONDITION_END"} */
165 :
166 : /* LDV {"action": "WRITE", "type": "CALL_BEGIN", "callback": true, "comment": "Write data to the device. Invoke callback write from FILE_OPERATIONS."} */
167 : /* Callback pre-call */
168 2 : ldv_assume(ldv_1_size_cnt_func_1_ptr <= (INT_MAX & PAGE_CACHE_MASK));
169 3 : if (ldv_1_container_file_operations->write) {
170 : /* LDV {"type": "CALLBACK", "call": "(ldv_1_container_file_operations->write)(ldv_1_resource_file, ldv_1_ldv_param_4_1_default, ldv_1_size_cnt_write_size, ldv_1_ldv_param_4_3_default);", "comment": "write"} */
171 3 : ldv_character_driver_scenario_write_1_4(ldv_1_container_file_operations->write, ldv_1_resource_file, ldv_1_ldv_param_4_1_default, ldv_1_size_cnt_write_size, ldv_1_ldv_param_4_3_default);
172 : }
173 : /* LDV {"action": "WRITE", "type": "CALL_END"} */
174 :
175 : /* LDV {"action": "POST_CALL_4", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
176 4 : ldv_free(ldv_1_ldv_param_4_1_default);
177 2 : ldv_free(ldv_1_ldv_param_4_3_default);
178 : /* LDV {"action": "POST_CALL_4", "type": "CONDITION_END"} */
179 :
180 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Device file is opened, ready to read and write."} */
181 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
182 :
183 : /* Jump to a subprocess 'call' initial state */
184 1 : goto ldv_call_1;
185 1 : break;
186 : }
187 3 : case 2: {
188 : /* LDV {"action": "RELEASE", "type": "CALL_BEGIN", "comment": "Call callback 'release' of a process 'character_driver_scenario' of an interface category 'file_operations'"} */
189 : /* Skip callback without implementations */
190 : /* LDV {"action": "RELEASE", "type": "CALL_END"} */
191 :
192 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Device appeared in the system."} */
193 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
194 :
195 : /* Jump to a subprocess 'main' initial state */
196 1 : goto ldv_main_1;
197 1 : break;
198 : }
199 3 : case 3: {
200 : /* LDV {"action": "PRE_CALL_5", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
201 3 : ldv_1_ldv_param_5_1_default = ldv_xmalloc_unknown_size(0);
202 3 : ldv_1_ldv_param_5_3_default = ldv_xmalloc_unknown_size(0);
203 : /* LDV {"action": "PRE_CALL_5", "type": "CONDITION_END"} */
204 :
205 4 : if (ldv_undef_int()) {
206 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback readdir from file_operations."} */
207 : /* LDV {"type": "CALLBACK", "call": "((& isofs_readdir))(ldv_1_resource_file, ldv_1_resource_inode, ldv_1_size_cnt_func_1_ptr);", "comment": "callback"} */
208 2 : ldv_character_driver_scenario_callback_1_22(ldv_1_callback_readdir, ldv_1_resource_file, ldv_1_resource_inode, ldv_1_size_cnt_func_1_ptr);
209 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
210 :
211 : }
212 : else {
213 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback read from file_operations."} */
214 : /* LDV {"type": "CALLBACK", "call": "((& generic_read_dir))(ldv_1_resource_file, ldv_1_ldv_param_5_1_default, ldv_1_size_cnt_write_size, ldv_1_ldv_param_5_3_default);", "comment": "callback"} */
215 2 : ldv_character_driver_scenario_callback_1_5(ldv_1_callback_read, ldv_1_resource_file, ldv_1_ldv_param_5_1_default, ldv_1_size_cnt_write_size, ldv_1_ldv_param_5_3_default);
216 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
217 :
218 : }
219 2 : break;
220 1 : }
221 2 : default: ldv_stop();
222 1 : }
223 0 : /* LDV {"action": "POST_CALL_5", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
224 4 : ldv_free(ldv_1_ldv_param_5_1_default);
225 2 : ldv_free(ldv_1_ldv_param_5_3_default);
226 : /* LDV {"action": "POST_CALL_5", "type": "CONDITION_END"} */
227 :
228 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Device file is opened, ready to read and write."} */
229 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
230 :
231 : /* Jump to a subprocess 'call' initial state */
232 1 : goto ldv_call_1;
233 : /* Jump to a subprocess 'call' initial state */
234 : goto ldv_call_1;
235 : /* End of the subprocess 'call' */
236 : return;
237 : /* LDV {"comment": "End of control function based on process 'character_driver_scenario(file_operations)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_character_driver_scenario_1"} */
238 : }
239 :
240 : /* AUX_FUNC_CALLBACK ldv_character_driver_scenario_callback_1_22 */
241 : void ldv_character_driver_scenario_callback_1_22(int (*arg0)(struct file *, void *, filldir_t ), struct file *arg1, void *arg2, int (*arg3)(void *, char *, int, loff_t , u64 , unsigned int)) {
242 3 : ((& isofs_readdir))(arg1, arg2, arg3);
243 1 : }
244 :
245 : /* AUX_FUNC_CALLBACK ldv_character_driver_scenario_callback_1_5 */
246 : void ldv_character_driver_scenario_callback_1_5(ssize_t (*arg0)(struct file *, char *, long unsigned int, loff_t *), struct file *arg1, char *arg2, long unsigned int arg3, long long int *arg4) {
247 1 : ((& generic_read_dir))(arg1, arg2, arg3, arg4);
248 1 : }
249 :
250 : /* AUX_FUNC_CALLBACK ldv_random_containerless_scenario_callback_8_4 */
251 : void ldv_random_containerless_scenario_callback_8_4(struct dentry *(*arg0)(struct inode *, struct dentry *, struct nameidata *), struct inode *arg1, struct dentry *arg2, struct nameidata *arg3) {
252 5 : ((& isofs_lookup))(arg1, arg2, arg3);
253 1 : }
254 :
255 :
256 : /* AUX_FUNC ERR_PTR */
257 : static inline void *ERR_PTR (long int error)
258 : {
259 :
260 : return ldv_err_ptr(error);
261 : }
262 :
263 : /* AUX_FUNC PTR_ERR */
264 : static inline long int PTR_ERR (void const *ptr)
265 : {
266 :
267 : return ldv_ptr_err(ptr);
268 : }
269 :
270 : /* AUX_FUNC IS_ERR */
271 : static inline long int IS_ERR (void const *ptr)
272 : {
273 :
274 : return ldv_is_err(ptr);
275 : }
276 :
277 : /* AUX_FUNC IS_ERR_OR_NULL */
278 : static inline long int IS_ERR_OR_NULL (void const *ptr)
279 : {
280 :
281 : return ldv_is_err_or_null(ptr);
282 : }
283 :
284 : /* AUX_FUNC kzalloc */
285 : static inline void *kzalloc (size_t size, gfp_t flags)
286 : {
287 :
288 : return ldv_kzalloc(size, flags);
289 : }
|