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/fs.h>
30 : #include <linux/pagemap.h>
31 :
32 :
33 : struct ldv_struct_character_driver_scenario_1 {
34 : struct file_operations *arg0;
35 : int signal_pending;
36 : };
37 :
38 : struct ldv_struct_insmod_7 {
39 : int signal_pending;
40 : };
41 :
42 : /* EMG Function declarations */
43 : void ldv_character_driver_scenario_1(void *);
44 : extern void ldv_character_driver_scenario_2(void *);
45 : extern void ldv_character_driver_scenario_3(void *);
46 : extern void ldv_character_driver_scenario_callback_1_20(int (*)(struct file_system_type *, int, char *, void *, struct vfsmount *), struct file_system_type *, int, char *, void *, struct vfsmount *);
47 : extern void ldv_character_driver_scenario_callback_1_23(int (*)(struct inode *, struct file *, unsigned int, long unsigned int), struct inode *, struct file *, unsigned int, long unsigned int);
48 : extern void ldv_character_driver_scenario_callback_1_26(void (*)(struct super_block *), struct super_block *);
49 : extern void ldv_character_driver_scenario_callback_1_29(loff_t (*)(struct file *, loff_t , int), struct file *, long long int, int);
50 : extern void ldv_character_driver_scenario_callback_1_32(ssize_t (*)(struct file *, char *, size_t , loff_t *), struct file *, char *, long unsigned int, loff_t *);
51 : extern void ldv_character_driver_scenario_callback_1_35(int (*)(struct file *, void *, filldir_t ), struct file *, void *, int (*)(void *, char *, int, loff_t , u64 , unsigned int));
52 : void ldv_character_driver_scenario_callback_1_36(long int (*)(struct file *, unsigned int, long unsigned int), struct file *, unsigned int, long unsigned int);
53 : void ldv_character_driver_scenario_callback_1_5(long int (*)(struct file *, unsigned int, long unsigned int), struct file *, unsigned int, long unsigned int);
54 : extern int ldv_character_driver_scenario_probe_1_12(int (*)(struct inode *, struct file *), struct inode *, struct file *);
55 : extern void ldv_character_driver_scenario_release_1_2(int (*)(struct inode *, struct file *), struct inode *, struct file *);
56 : extern void ldv_character_driver_scenario_write_1_4(ssize_t (*)(struct file *, char *, size_t , loff_t *), struct file *, char *, long unsigned int, loff_t *);
57 : void ldv_dispatch_deregister_8_1(struct file_operations *);
58 : void ldv_dispatch_register_9_3(struct file_operations *);
59 : void ldv_emg_misc_deregister(struct miscdevice *);
60 : int ldv_emg_misc_register(struct miscdevice *);
61 :
62 : /* EMG variable declarations */
63 1 : struct ldv_thread ldv_thread_1;
64 :
65 : /* EMG variable initialization */
66 :
67 : /* EMG function definitions */
68 : /* AUX_FUNC ldv_character_driver_scenario_1 */
69 : void ldv_character_driver_scenario_1(void *arg0) {
70 : /* LDV {"thread": 1, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'character_driver_scenario(file_operations)'", "function": "ldv_character_driver_scenario_1"} */
71 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
72 1 : long int (*ldv_1_callback_compat_ioctl)(struct file *, unsigned int, long unsigned int);
73 : int (*ldv_1_callback_get_sb)(struct file_system_type *, int, char *, void *, struct vfsmount *);
74 1 : int (*ldv_1_callback_ioctl)(struct inode *, struct file *, unsigned int, long unsigned int);
75 1 : void (*ldv_1_callback_kill_sb)(struct super_block *);
76 1 : loff_t (*ldv_1_callback_llseek)(struct file *, loff_t , int);
77 1 : ssize_t (*ldv_1_callback_read)(struct file *, char *, size_t , loff_t *);
78 1 : int (*ldv_1_callback_readdir)(struct file *, void *, filldir_t );
79 : long int (*ldv_1_callback_unlocked_ioctl)(struct file *, unsigned int, long unsigned int);
80 : struct file_operations *ldv_1_container_file_operations;
81 1 : int ldv_1_ldv_param_20_1_default;
82 1 : char *ldv_1_ldv_param_20_2_default;
83 1 : unsigned int ldv_1_ldv_param_23_2_default;
84 1 : struct super_block *ldv_1_ldv_param_26_0_default;
85 1 : long long int ldv_1_ldv_param_29_1_default;
86 1 : int ldv_1_ldv_param_29_2_default;
87 1 : char *ldv_1_ldv_param_32_1_default;
88 1 : long long int *ldv_1_ldv_param_32_3_default;
89 1 : unsigned int ldv_1_ldv_param_36_1_default;
90 1 : char *ldv_1_ldv_param_4_1_default;
91 1 : long long int *ldv_1_ldv_param_4_3_default;
92 1 : unsigned int ldv_1_ldv_param_5_1_default;
93 1 : struct file *ldv_1_resource_file;
94 1 : struct inode *ldv_1_resource_inode;
95 1 : struct file_system_type *ldv_1_resource_struct_file_system_type;
96 1 : int ldv_1_ret_default;
97 1 : int (*ldv_1_size_cnt_func_1_ptr)(void *, char *, int, loff_t , u64 , unsigned int);
98 1 : struct super_block *ldv_1_size_cnt_struct_super_block_ptr;
99 1 : struct vfsmount *ldv_1_size_cnt_struct_vfsmount_ptr;
100 1 : long unsigned int ldv_1_size_cnt_write_size;
101 1 : /* Received labels */
102 2 : struct ldv_struct_character_driver_scenario_1 *data = (struct ldv_struct_character_driver_scenario_1*) arg0;
103 1 :
104 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
105 1 : /* Initialize automaton variables */
106 2 : ldv_1_ret_default = 1;
107 1 : /* LDV {"action": "REGISTER", "type": "RECEIVE_BEGIN", "comment": "Begin FILE_OPERATIONS callbacks invocations scenario."} */
108 1 : /* Assign recieved labels */
109 3 : if (data) {
110 2 : ldv_1_container_file_operations = data->arg0;
111 3 : ldv_free(data);
112 1 : }
113 1 : /* LDV {"action": "REGISTER", "type": "RECEIVE_END"} */
114 1 :
115 1 : /* LDV {"action": "INIT", "type": "CONDITION_BEGIN", "comment": "Allocate memory for file and inode structures."} */
116 6 : ldv_1_resource_file = ldv_xmalloc(sizeof(struct file));
117 3 : ldv_1_resource_inode = ldv_xmalloc(sizeof(struct inode));
118 3 : ldv_1_resource_struct_file_system_type = ldv_xmalloc_unknown_size(0);
119 3 : ldv_1_size_cnt_func_1_ptr = ldv_undef_int();
120 : /* LDV {"action": "INIT", "type": "CONDITION_END"} */
121 :
122 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Device appeared in the system."} */
123 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
124 :
125 : /* Jump to a subprocess 'main' initial state */
126 1 : goto ldv_main_1;
127 : /* End of the process */
128 : return;
129 1 :
130 : /* Sbprocess main */
131 : ldv_main_1:
132 : /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
133 :
134 4 : if (ldv_undef_int()) {
135 : /* LDV {"action": "PROBE", "type": "CALL_BEGIN", "callback": true, "comment": "Open the device file. Invoke callback probe from FILE_OPERATIONS."} */
136 3 : if (ldv_1_container_file_operations->open) {
137 : /* LDV {"type": "CALLBACK", "call": "ldv_1_ret_default = (ldv_1_container_file_operations->open)(ldv_1_resource_inode, ldv_1_resource_file);", "comment": "probe"} */
138 2 : ldv_1_ret_default = ldv_character_driver_scenario_probe_1_12(ldv_1_container_file_operations->open, ldv_1_resource_inode, ldv_1_resource_file);
139 : }
140 : /* Callback post-call */
141 4 : ldv_1_ret_default = ldv_filter_err_code(ldv_1_ret_default);
142 : /* LDV {"action": "PROBE", "type": "CALL_END"} */
143 :
144 4 : if (ldv_undef_int()) {
145 : /* LDV {"action": "PROBE_SUCCESS", "type": "CONDITION_BEGIN", "comment": "Device file is opened successfully."} */
146 2 : ldv_assume(ldv_1_ret_default == 0);
147 : /* LDV {"action": "PROBE_SUCCESS", "type": "CONDITION_END"} */
148 :
149 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Device file is opened, ready to read and write."} */
150 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
151 :
152 : /* Jump to a subprocess 'call' initial state */
153 1 : goto ldv_call_1;
154 : }
155 : else {
156 : /* LDV {"action": "PROBE_FAIL", "type": "CONDITION_BEGIN", "comment": "Failed to open devices file."} */
157 2 : ldv_assume(ldv_1_ret_default != 0);
158 : /* LDV {"action": "PROBE_FAIL", "type": "CONDITION_END"} */
159 :
160 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Device appeared in the system."} */
161 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
162 :
163 : /* Jump to a subprocess 'main' initial state */
164 1 : goto ldv_main_1;
165 : }
166 : }
167 : else {
168 : /* LDV {"action": "FREE", "type": "CONDITION_BEGIN", "comment": "Free memory of file and inode structures."} */
169 2 : ldv_free(ldv_1_resource_file);
170 2 : ldv_free(ldv_1_resource_inode);
171 2 : ldv_free(ldv_1_resource_struct_file_system_type);
172 : /* LDV {"action": "FREE", "type": "CONDITION_END"} */
173 :
174 : /* LDV {"action": "DEREGISTER", "type": "RECEIVE_BEGIN", "comment": "Finish FILE_OPERATIONS callbacks invocations scenario."} */
175 : /* Skip a non-replicative signal receiving */
176 : /* LDV {"action": "DEREGISTER", "type": "RECEIVE_END"} */
177 :
178 : /* Exit function at a terminal state */
179 1 : return;
180 : }
181 : /* End of the subprocess 'main' */
182 : return;
183 1 :
184 : /* Sbprocess call */
185 : ldv_call_1:
186 : /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
187 :
188 2 : switch (ldv_undef_int()) {
189 3 : case 1: {
190 : /* LDV {"action": "PRE_CALL_4", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
191 3 : ldv_1_ldv_param_4_1_default = ldv_xmalloc_unknown_size(0);
192 3 : ldv_1_ldv_param_4_3_default = ldv_xmalloc_unknown_size(0);
193 : /* LDV {"action": "PRE_CALL_4", "type": "CONDITION_END"} */
194 :
195 : /* LDV {"action": "WRITE", "type": "CALL_BEGIN", "callback": true, "comment": "Write data to the device. Invoke callback write from FILE_OPERATIONS."} */
196 : /* Callback pre-call */
197 2 : ldv_assume(ldv_1_size_cnt_func_1_ptr <= (INT_MAX & PAGE_CACHE_MASK));
198 3 : if (ldv_1_container_file_operations->write) {
199 : /* 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"} */
200 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);
201 : }
202 : /* LDV {"action": "WRITE", "type": "CALL_END"} */
203 :
204 : /* LDV {"action": "POST_CALL_4", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
205 4 : ldv_free(ldv_1_ldv_param_4_1_default);
206 2 : ldv_free(ldv_1_ldv_param_4_3_default);
207 : /* LDV {"action": "POST_CALL_4", "type": "CONDITION_END"} */
208 :
209 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Device file is opened, ready to read and write."} */
210 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
211 :
212 : /* Jump to a subprocess 'call' initial state */
213 1 : goto ldv_call_1;
214 1 : break;
215 : }
216 3 : case 2: {
217 : /* LDV {"action": "RELEASE", "type": "CALL_BEGIN", "callback": true, "comment": "File structure is released. Invoke callback release from FILE_OPERATIONS."} */
218 3 : if (ldv_1_container_file_operations->release) {
219 : /* LDV {"type": "CALLBACK", "call": "(ldv_1_container_file_operations->release)(ldv_1_resource_inode, ldv_1_resource_file);", "comment": "release"} */
220 2 : ldv_character_driver_scenario_release_1_2(ldv_1_container_file_operations->release, ldv_1_resource_inode, ldv_1_resource_file);
221 : }
222 : /* LDV {"action": "RELEASE", "type": "CALL_END"} */
223 :
224 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Device appeared in the system."} */
225 : /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
226 :
227 : /* Jump to a subprocess 'main' initial state */
228 2 : goto ldv_main_1;
229 1 : break;
230 : }
231 3 : case 3: {
232 : /* LDV {"action": "PRE_CALL_5", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
233 : /* LDV {"action": "PRE_CALL_5", "type": "CONDITION_END"} */
234 :
235 2 : switch (ldv_undef_int()) {
236 3 : case 1: {
237 : /* LDV {"action": "PRE_CALL_36", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
238 : /* LDV {"action": "PRE_CALL_36", "type": "CONDITION_END"} */
239 :
240 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback unlocked_ioctl from file_operations."} */
241 : /* LDV {"type": "CALLBACK", "call": "(( & autofs_dev_ioctl))(ldv_1_resource_file, ldv_1_ldv_param_36_1_default, ldv_1_size_cnt_write_size);", "comment": "callback"} */
242 2 : ldv_character_driver_scenario_callback_1_36(ldv_1_callback_unlocked_ioctl, ldv_1_resource_file, ldv_1_ldv_param_36_1_default, ldv_1_size_cnt_write_size);
243 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
244 :
245 : /* LDV {"action": "POST_CALL_36", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
246 : /* LDV {"action": "POST_CALL_36", "type": "CONDITION_END"} */
247 :
248 1 : break;
249 1 : }
250 3 : case 2: {
251 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback callback from FILE_OPERATIONS."} */
252 2 : if (ldv_1_callback_readdir) {
253 : /* LDV {"type": "CALLBACK", "call": "(ldv_1_callback_readdir)(ldv_1_resource_file, ldv_1_resource_inode, ldv_1_size_cnt_func_1_ptr);", "comment": "callback"} */
254 2 : ldv_character_driver_scenario_callback_1_35(ldv_1_callback_readdir, ldv_1_resource_file, ldv_1_resource_inode, ldv_1_size_cnt_func_1_ptr);
255 : }
256 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
257 :
258 2 : break;
259 1 : }
260 3 : case 3: {
261 : /* LDV {"action": "PRE_CALL_32", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
262 3 : ldv_1_ldv_param_32_1_default = ldv_xmalloc_unknown_size(0);
263 3 : ldv_1_ldv_param_32_3_default = ldv_xmalloc_unknown_size(0);
264 : /* LDV {"action": "PRE_CALL_32", "type": "CONDITION_END"} */
265 :
266 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback callback from FILE_OPERATIONS."} */
267 2 : if (ldv_1_callback_read) {
268 : /* LDV {"type": "CALLBACK", "call": "(ldv_1_callback_read)(ldv_1_resource_file, ldv_1_ldv_param_32_1_default, ldv_1_size_cnt_write_size, ldv_1_ldv_param_32_3_default);", "comment": "callback"} */
269 2 : ldv_character_driver_scenario_callback_1_32(ldv_1_callback_read, ldv_1_resource_file, ldv_1_ldv_param_32_1_default, ldv_1_size_cnt_write_size, ldv_1_ldv_param_32_3_default);
270 : }
271 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
272 :
273 : /* LDV {"action": "POST_CALL_32", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
274 4 : ldv_free(ldv_1_ldv_param_32_1_default);
275 2 : ldv_free(ldv_1_ldv_param_32_3_default);
276 : /* LDV {"action": "POST_CALL_32", "type": "CONDITION_END"} */
277 :
278 1 : break;
279 1 : }
280 3 : case 4: {
281 : /* LDV {"action": "PRE_CALL_29", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
282 : /* LDV {"action": "PRE_CALL_29", "type": "CONDITION_END"} */
283 :
284 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback callback from FILE_OPERATIONS."} */
285 2 : if (ldv_1_callback_llseek) {
286 : /* LDV {"type": "CALLBACK", "call": "(ldv_1_callback_llseek)(ldv_1_resource_file, ldv_1_ldv_param_29_1_default, ldv_1_ldv_param_29_2_default);", "comment": "callback"} */
287 2 : ldv_character_driver_scenario_callback_1_29(ldv_1_callback_llseek, ldv_1_resource_file, ldv_1_ldv_param_29_1_default, ldv_1_ldv_param_29_2_default);
288 : }
289 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
290 :
291 : /* LDV {"action": "POST_CALL_29", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
292 : /* LDV {"action": "POST_CALL_29", "type": "CONDITION_END"} */
293 :
294 2 : break;
295 1 : }
296 3 : case 5: {
297 : /* LDV {"action": "PRE_CALL_26", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
298 3 : ldv_1_ldv_param_26_0_default = ldv_xmalloc_unknown_size(0);
299 : /* LDV {"action": "PRE_CALL_26", "type": "CONDITION_END"} */
300 :
301 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback kill_sb from file_system_type."} */
302 : /* LDV {"type": "CALLBACK", "call": "((& autofs4_kill_sb))(ldv_1_ldv_param_26_0_default);", "comment": "callback"} */
303 2 : ldv_character_driver_scenario_callback_1_26(ldv_1_callback_kill_sb, ldv_1_ldv_param_26_0_default);
304 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
305 :
306 : /* LDV {"action": "POST_CALL_26", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
307 2 : ldv_free(ldv_1_ldv_param_26_0_default);
308 : /* LDV {"action": "POST_CALL_26", "type": "CONDITION_END"} */
309 :
310 1 : break;
311 1 : }
312 3 : case 6: {
313 : /* LDV {"action": "PRE_CALL_23", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
314 : /* LDV {"action": "PRE_CALL_23", "type": "CONDITION_END"} */
315 :
316 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback callback from FILE_OPERATIONS."} */
317 2 : if (ldv_1_callback_ioctl) {
318 : /* LDV {"type": "CALLBACK", "call": "(ldv_1_callback_ioctl)(ldv_1_resource_inode, ldv_1_resource_file, ldv_1_ldv_param_23_2_default, ldv_1_size_cnt_write_size);", "comment": "callback"} */
319 2 : ldv_character_driver_scenario_callback_1_23(ldv_1_callback_ioctl, ldv_1_resource_inode, ldv_1_resource_file, ldv_1_ldv_param_23_2_default, ldv_1_size_cnt_write_size);
320 : }
321 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
322 :
323 : /* LDV {"action": "POST_CALL_23", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
324 : /* LDV {"action": "POST_CALL_23", "type": "CONDITION_END"} */
325 :
326 2 : break;
327 1 : }
328 3 : case 7: {
329 : /* LDV {"action": "PRE_CALL_20", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
330 3 : ldv_1_ldv_param_20_2_default = ldv_xmalloc_unknown_size(0);
331 : /* LDV {"action": "PRE_CALL_20", "type": "CONDITION_END"} */
332 :
333 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback get_sb from file_system_type."} */
334 : /* LDV {"type": "CALLBACK", "call": "((& autofs_get_sb))(ldv_1_resource_struct_file_system_type, ldv_1_ldv_param_20_1_default, ldv_1_ldv_param_20_2_default, ldv_1_resource_file, ldv_1_size_cnt_struct_vfsmount_ptr);", "comment": "callback"} */
335 2 : ldv_character_driver_scenario_callback_1_20(ldv_1_callback_get_sb, ldv_1_resource_struct_file_system_type, ldv_1_ldv_param_20_1_default, ldv_1_ldv_param_20_2_default, ldv_1_resource_file, ldv_1_size_cnt_struct_vfsmount_ptr);
336 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
337 :
338 : /* LDV {"action": "POST_CALL_20", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
339 2 : ldv_free(ldv_1_ldv_param_20_2_default);
340 : /* LDV {"action": "POST_CALL_20", "type": "CONDITION_END"} */
341 :
342 1 : break;
343 1 : }
344 3 : case 8: {
345 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback compat_ioctl from file_operations."} */
346 : /* LDV {"type": "CALLBACK", "call": "(( & autofs_dev_ioctl_compat))(ldv_1_resource_file, ldv_1_ldv_param_5_1_default, ldv_1_size_cnt_write_size);", "comment": "callback"} */
347 2 : ldv_character_driver_scenario_callback_1_5(ldv_1_callback_compat_ioctl, ldv_1_resource_file, ldv_1_ldv_param_5_1_default, ldv_1_size_cnt_write_size);
348 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
349 :
350 1 : break;
351 1 : }
352 2 : default: ldv_stop();
353 1 : }
354 9 : break;
355 1 : }
356 2 : default: ldv_stop();
357 1 : }
358 0 : /* LDV {"action": "POST_CALL_5", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
359 : /* LDV {"action": "POST_CALL_5", "type": "CONDITION_END"} */
360 0 :
361 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Device file is opened, ready to read and write."} */
362 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
363 :
364 : /* Jump to a subprocess 'call' initial state */
365 9 : goto ldv_call_1;
366 : /* Jump to a subprocess 'call' initial state */
367 : goto ldv_call_1;
368 : /* End of the subprocess 'call' */
369 : return;
370 : /* LDV {"comment": "End of control function based on process 'character_driver_scenario(file_operations)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_character_driver_scenario_1"} */
371 : }
372 :
373 : /* AUX_FUNC_CALLBACK ldv_character_driver_scenario_callback_1_36 */
374 : void ldv_character_driver_scenario_callback_1_36(long int (*arg0)(struct file *, unsigned int, long unsigned int), struct file *arg1, unsigned int arg2, long unsigned int arg3) {
375 2 : (( & autofs_dev_ioctl))(arg1, arg2, arg3);
376 1 : }
377 :
378 : /* AUX_FUNC_CALLBACK ldv_character_driver_scenario_callback_1_5 */
379 : void ldv_character_driver_scenario_callback_1_5(long int (*arg0)(struct file *, unsigned int, long unsigned int), struct file *arg1, unsigned int arg2, long unsigned int arg3) {
380 2 : (( & autofs_dev_ioctl_compat))(arg1, arg2, arg3);
381 1 : }
382 :
383 : /* AUX_FUNC ldv_dispatch_deregister_8_1 */
384 : void ldv_dispatch_deregister_8_1(struct file_operations *arg0) {
385 : struct ldv_struct_character_driver_scenario_1 *cf_arg_1;
386 2 : struct ldv_struct_character_driver_scenario_1 *cf_arg_2;
387 : struct ldv_struct_character_driver_scenario_1 *cf_arg_3;
388 4 : switch (ldv_undef_int()) {
389 6 : case 0: {
390 : /* Skip thread join call */
391 2 : break;
392 2 : };
393 6 : case 1: {
394 : /* Skip thread join call */
395 2 : break;
396 2 : };
397 6 : case 2: {
398 : /* Skip thread join call */
399 2 : break;
400 2 : };
401 4 : default: ldv_stop();
402 2 : };
403 2 : return;
404 : }
405 0 :
406 : /* AUX_FUNC ldv_dispatch_register_9_3 */
407 : void ldv_dispatch_register_9_3(struct file_operations *arg0) {
408 : struct ldv_struct_character_driver_scenario_1 *cf_arg_1;
409 1 : struct ldv_struct_character_driver_scenario_1 *cf_arg_2;
410 1 : struct ldv_struct_character_driver_scenario_1 *cf_arg_3;
411 3 : switch (ldv_undef_int()) {
412 4 : case 0: {
413 4 : cf_arg_1 = ldv_xmalloc(sizeof(struct ldv_struct_character_driver_scenario_1));
414 2 : cf_arg_1->arg0 = arg0;
415 3 : ldv_character_driver_scenario_1(cf_arg_1);
416 1 : break;
417 1 : };
418 3 : case 1: {
419 3 : cf_arg_2 = ldv_xmalloc(sizeof(struct ldv_struct_character_driver_scenario_1));
420 1 : cf_arg_2->arg0 = arg0;
421 2 : ldv_character_driver_scenario_2(cf_arg_2);
422 1 : break;
423 1 : };
424 3 : case 2: {
425 3 : cf_arg_3 = ldv_xmalloc(sizeof(struct ldv_struct_character_driver_scenario_1));
426 1 : cf_arg_3->arg0 = arg0;
427 2 : ldv_character_driver_scenario_3(cf_arg_3);
428 1 : break;
429 1 : };
430 2 : default: ldv_stop();
431 1 : };
432 3 : return;
433 : }
434 0 :
435 : /* AUX_FUNC ldv_emg_misc_deregister */
436 : void ldv_emg_misc_deregister(struct miscdevice *arg0) {
437 : /* LDV {"comment": "Control function 'misc_deregister'", "type": "CONTROL_FUNCTION_BEGIN", "function": "ldv_emg_misc_deregister"} */
438 2 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
439 2 : struct file_operations *ldv_8_file_operations_file_operations;
440 : struct miscdevice *ldv_8_miscdevice_miscdevice;
441 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
442 : /* LDV {"action": "ASSIGN", "type": "CONDITION_BEGIN", "comment": "Extract a file_operations structure pointer."} */
443 2 : ldv_8_miscdevice_miscdevice = arg0;
444 4 : ldv_8_file_operations_file_operations = ldv_8_miscdevice_miscdevice->fops;
445 : /* LDV {"action": "ASSIGN", "type": "CONDITION_END"} */
446 :
447 : /* LDV {"action": "DEREGISTER", "type": "DISPATCH_BEGIN", "comment": "Deregister FILE_OPERATIONS callbacks."} */
448 4 : ldv_dispatch_deregister_8_1(ldv_8_file_operations_file_operations);
449 : /* LDV {"action": "DEREGISTER", "type": "DISPATCH_END"} */
450 :
451 : /* Exit function at a terminal state */
452 2 : return;
453 : /* End of the process */
454 : return;
455 : /* LDV {"comment": "End of control function based on process 'misc_deregister'", "type": "CONTROL_FUNCTION_END", "function": "ldv_emg_misc_deregister"} */
456 : }
457 :
458 : /* AUX_FUNC ldv_emg_misc_register */
459 : int ldv_emg_misc_register(struct miscdevice *arg0) {
460 : /* LDV {"comment": "Control function 'misc_register'", "type": "CONTROL_FUNCTION_BEGIN", "function": "ldv_emg_misc_register"} */
461 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
462 1 : struct file_operations *ldv_9_file_operations_file_operations;
463 1 : struct miscdevice *ldv_9_miscdevice_miscdevice;
464 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
465 : /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
466 :
467 4 : if (ldv_undef_int()) {
468 : /* LDV {"action": "ASSIGN", "type": "CONDITION_BEGIN", "comment": "Extract a file_operations structure pointer."} */
469 1 : ldv_9_miscdevice_miscdevice = arg0;
470 2 : ldv_9_file_operations_file_operations = ldv_9_miscdevice_miscdevice->fops;
471 : /* LDV {"action": "ASSIGN", "type": "CONDITION_END"} */
472 :
473 : /* LDV {"action": "REGISTER", "type": "DISPATCH_BEGIN", "comment": "Register file_operations callbacks of the miscellaneous character driver."} */
474 4 : ldv_dispatch_register_9_3(ldv_9_file_operations_file_operations);
475 : /* LDV {"action": "REGISTER", "type": "DISPATCH_END"} */
476 :
477 : /* LDV {"action": "SUCCESS", "type": "CONDITION_BEGIN", "comment": "Successfully registered the miscellaneous character driver."} */
478 1 : return 0;
479 : /* LDV {"action": "SUCCESS", "type": "CONDITION_END"} */
480 :
481 : /* Exit function at a terminal state */
482 : }
483 : else {
484 : /* LDV {"action": "FAIL", "type": "CONDITION_BEGIN", "comment": "Fail to register the miscellaneous character driver."} */
485 3 : return ldv_undef_int_negative();
486 : /* LDV {"action": "FAIL", "type": "CONDITION_END"} */
487 :
488 : /* Exit function at a terminal state */
489 : }
490 : /* End of the process */
491 : /* LDV {"comment": "End of control function based on process 'misc_register'", "type": "CONTROL_FUNCTION_END", "function": "ldv_emg_misc_register"} */
492 : }
493 :
494 :
495 : /* AUX_FUNC ERR_PTR */
496 : static inline void *ERR_PTR (long int error)
497 : {
498 :
499 : return ldv_err_ptr(error);
500 : }
501 :
502 : /* AUX_FUNC PTR_ERR */
503 : static inline long int PTR_ERR (void const *ptr)
504 : {
505 2 :
506 6 : return ldv_ptr_err(ptr);
507 : }
508 :
509 : /* AUX_FUNC IS_ERR */
510 : static inline long int IS_ERR (void const *ptr)
511 : {
512 :
513 : return ldv_is_err(ptr);
514 : }
515 :
516 : /* AUX_FUNC IS_ERR_OR_NULL */
517 : static inline long int IS_ERR_OR_NULL (void const *ptr)
518 : {
519 :
520 : return ldv_is_err_or_null(ptr);
521 : }
522 :
523 : /* AUX_FUNC kzalloc */
524 : static inline void *kzalloc (size_t size, gfp_t flags)
525 : {
526 :
527 : return ldv_kzalloc(size, flags);
528 : }
529 :
530 : /* AUX_FUNC ldv_misc_register_6 */
531 : int ldv_misc_register_6 (struct miscdevice *ldv_func_arg1)
532 : {
533 1 :
534 : /* LDV {"type": "KERNEL_MODEL", "comment": "Perform the model code of the function 'misc_register'"} */
535 4 : return ldv_emg_misc_register(ldv_func_arg1);
536 : }
537 :
538 : /* AUX_FUNC ldv_misc_deregister_7 */
539 : int ldv_misc_deregister_7 (struct miscdevice *ldv_func_arg1)
540 : {
541 :
542 : /* LDV {"type": "KERNEL_MODEL", "comment": "Perform the model code of the function 'misc_deregister'"} */
543 4 : ldv_emg_misc_deregister(ldv_func_arg1);
544 2 : }
|