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 <scsi/scsi_host.h>
29 : #include <linux/usb.h>
30 :
31 :
32 : struct ldv_struct_insmod_12 {
33 : int signal_pending;
34 : };
35 :
36 : struct ldv_struct_scsi_LLDd_scenario_1 {
37 : struct Scsi_Host *arg0;
38 : int signal_pending;
39 : };
40 :
41 : struct ldv_struct_usb_scenario_11 {
42 : struct usb_driver *arg0;
43 : int signal_pending;
44 : };
45 :
46 : /* EMG Function declarations */
47 : struct Scsi_Host *ldv_emg_scsi_host_alloc(struct scsi_host_template *, int);
48 : void ldv_random_containerless_scenario_2(void *);
49 : void ldv_random_containerless_scenario_callback_2_10(ssize_t (*)(struct device *, struct device_attribute *, char *, size_t ), struct device *, struct device_attribute *, char *, long unsigned int);
50 : void ldv_random_containerless_scenario_callback_2_4(ssize_t (*)(struct device *, struct device_attribute *, char *), struct device *, struct device_attribute *, char *);
51 : void ldv_scsi_LLDd_scenario_callback_1_13(int (*)(struct scsi_cmnd *), struct scsi_cmnd *);
52 : void ldv_scsi_LLDd_scenario_callback_1_14(int (*)(struct scsi_cmnd *), struct scsi_cmnd *);
53 : void ldv_scsi_LLDd_scenario_callback_1_15(char *(*)(struct Scsi_Host *), struct Scsi_Host *);
54 : void ldv_scsi_LLDd_scenario_callback_1_16(int (*)(struct Scsi_Host *, char *, char **, long int, int, int), struct Scsi_Host *, char *, char **, long int, int, int);
55 : void ldv_scsi_LLDd_scenario_callback_1_19(int (*)(struct scsi_cmnd *, void (*)(struct scsi_cmnd *)), struct scsi_cmnd *, void (*)(struct scsi_cmnd *));
56 : void ldv_scsi_LLDd_scenario_callback_1_22(int (*)(struct scsi_device *), struct scsi_device *);
57 : void ldv_scsi_LLDd_scenario_callback_1_23(int (*)(struct scsi_device *), struct scsi_device *);
58 : void ldv_scsi_LLDd_scenario_callback_1_4(int (*)(struct scsi_cmnd *), struct scsi_cmnd *);
59 :
60 : /* EMG variable declarations */
61 1 : struct ldv_thread ldv_thread_2;
62 :
63 : /* EMG variable initialization */
64 :
65 : /* EMG function definitions */
66 : /* AUX_FUNC ldv_emg_scsi_host_alloc */
67 : struct Scsi_Host * ldv_emg_scsi_host_alloc(struct scsi_host_template *arg0, int arg1) {
68 : /* LDV {"comment": "Control function 'scsi_host_alloc'", "type": "CONTROL_FUNCTION_BEGIN", "function": "ldv_emg_scsi_host_alloc"} */
69 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
70 1 : struct Scsi_Host *ldv_14_host_host;
71 1 : struct scsi_host_template *ldv_14_scsi_host_template_scsi_host_template;
72 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
73 : /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
74 :
75 4 : if (ldv_undef_int()) {
76 : /* LDV {"action": "ALLOC", "type": "CONDITION_BEGIN", "comment": "Allocate memory for a new Scsi_Host structure and initialize it."} */
77 3 : ldv_14_host_host = ldv_xmalloc(sizeof(struct Scsi_Host));
78 1 : ldv_14_scsi_host_template_scsi_host_template = arg0;
79 1 : ldv_14_host_host->hostt= ldv_14_scsi_host_template_scsi_host_template;
80 : /* LDV {"action": "ALLOC", "type": "CONDITION_END"} */
81 :
82 : /* LDV {"action": "SUCCESS", "type": "CONDITION_BEGIN", "comment": "A new Scsi_Host structure has been allocated successfully."} */
83 1 : return ldv_14_host_host;
84 : /* LDV {"action": "SUCCESS", "type": "CONDITION_END"} */
85 :
86 : /* Exit function at a terminal state */
87 : }
88 : else {
89 : /* LDV {"action": "FAIL", "type": "CONDITION_BEGIN", "comment": "A new Scsi_Host structure allocation has failed."} */
90 1 : return 0;
91 : /* LDV {"action": "FAIL", "type": "CONDITION_END"} */
92 :
93 : /* Exit function at a terminal state */
94 : }
95 : /* End of the process */
96 : /* LDV {"comment": "End of control function based on process 'scsi_host_alloc'", "type": "CONTROL_FUNCTION_END", "function": "ldv_emg_scsi_host_alloc"} */
97 : }
98 :
99 : /* AUX_FUNC ldv_random_containerless_scenario_2 */
100 : void ldv_random_containerless_scenario_2(void *arg0) {
101 : /* LDV {"thread": 2, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'random_containerless_scenario(struct_device_attribute)'", "function": "ldv_random_containerless_scenario_2"} */
102 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
103 1 : ssize_t (*ldv_2_callback_show)(struct device *, struct device_attribute *, char *);
104 : ssize_t (*ldv_2_callback_store)(struct device *, struct device_attribute *, char *, size_t );
105 1 : struct device_attribute *ldv_2_container_struct_device_attribute;
106 1 : struct device *ldv_2_container_struct_device_ptr;
107 1 : char *ldv_2_ldv_param_10_2_default;
108 1 : long unsigned int ldv_2_ldv_param_10_3_default;
109 1 : char *ldv_2_ldv_param_4_2_default;
110 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
111 1 : /* LDV {"action": "DEFAULT_REGISTER_7", "type": "RECEIVE_BEGIN", "comment": "Begin STRUCT_DEVICE_ATTRIBUTE callbacks invocations scenario."} */
112 3 : ldv_free(arg0);
113 1 : /* LDV {"action": "DEFAULT_REGISTER_7", "type": "RECEIVE_END"} */
114 1 :
115 1 : /* LDV {"action": "DEFAULT_ALLOC_7", "type": "CONDITION_BEGIN", "comment": "Allocate memory after default registration."} */
116 3 : ldv_2_container_struct_device_attribute = ldv_xmalloc_unknown_size(0);
117 3 : ldv_2_container_struct_device_ptr = ldv_xmalloc_unknown_size(0);
118 : /* LDV {"action": "DEFAULT_ALLOC_7", "type": "CONDITION_END"} */
119 :
120 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Prepare to call a random callback or deregister the callbacks."} */
121 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
122 :
123 : /* Jump to a subprocess 'call' initial state */
124 1 : goto ldv_call_2;
125 : /* End of the process */
126 : return;
127 1 :
128 : /* Sbprocess call */
129 : ldv_call_2:
130 : /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
131 :
132 4 : if (ldv_undef_int()) {
133 : /* LDV {"action": "PRE_CALL_4", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
134 3 : ldv_2_ldv_param_4_2_default = ldv_xmalloc_unknown_size(0);
135 : /* LDV {"action": "PRE_CALL_4", "type": "CONDITION_END"} */
136 :
137 4 : if (ldv_undef_int()) {
138 : /* LDV {"action": "PRE_CALL_10", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
139 3 : ldv_2_ldv_param_10_2_default = ldv_xmalloc_unknown_size(0);
140 : /* LDV {"action": "PRE_CALL_10", "type": "CONDITION_END"} */
141 :
142 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Call any random callback. Invoke callback store from device_attribute."} */
143 : /* LDV {"type": "CALLBACK", "call": "((& store_max_sectors))(ldv_2_container_struct_device_ptr, ldv_2_container_struct_device_attribute, ldv_2_ldv_param_10_2_default, ldv_2_ldv_param_10_3_default);", "comment": "callback"} */
144 2 : ldv_random_containerless_scenario_callback_2_10(ldv_2_callback_store, ldv_2_container_struct_device_ptr, ldv_2_container_struct_device_attribute, ldv_2_ldv_param_10_2_default, ldv_2_ldv_param_10_3_default);
145 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
146 :
147 : /* LDV {"action": "POST_CALL_10", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
148 2 : ldv_free(ldv_2_ldv_param_10_2_default);
149 : /* LDV {"action": "POST_CALL_10", "type": "CONDITION_END"} */
150 :
151 : }
152 : else {
153 : /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Call any random callback. Invoke callback show from device_attribute."} */
154 : /* LDV {"type": "CALLBACK", "call": "((& show_max_sectors))(ldv_2_container_struct_device_ptr, ldv_2_container_struct_device_attribute, ldv_2_ldv_param_4_2_default);", "comment": "callback"} */
155 2 : ldv_random_containerless_scenario_callback_2_4(ldv_2_callback_show, ldv_2_container_struct_device_ptr, ldv_2_container_struct_device_attribute, ldv_2_ldv_param_4_2_default);
156 : /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
157 :
158 : }
159 : /* LDV {"action": "POST_CALL_4", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
160 4 : ldv_free(ldv_2_ldv_param_4_2_default);
161 : /* LDV {"action": "POST_CALL_4", "type": "CONDITION_END"} */
162 :
163 : /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Prepare to call a random callback or deregister the callbacks."} */
164 : /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
165 :
166 : /* Jump to a subprocess 'call' initial state */
167 1 : goto ldv_call_2;
168 : }
169 : else {
170 : /* LDV {"action": "DEFAULT_FREE_7", "type": "CONDITION_BEGIN", "comment": "Free memory before default deregistration."} */
171 2 : ldv_free(ldv_2_container_struct_device_attribute);
172 2 : ldv_free(ldv_2_container_struct_device_ptr);
173 : /* LDV {"action": "DEFAULT_FREE_7", "type": "CONDITION_END"} */
174 :
175 : /* LDV {"action": "DEFAULT_DEREGISTER_7", "type": "RECEIVE_BEGIN", "comment": "Finish STRUCT_DEVICE_ATTRIBUTE callbacks invocations scenario."} */
176 : /* Skip a non-replicative signal receiving */
177 : /* LDV {"action": "DEFAULT_DEREGISTER_7", "type": "RECEIVE_END"} */
178 :
179 : /* Exit function at a terminal state */
180 1 : return;
181 : }
182 : /* End of the subprocess 'call' */
183 : return;
184 : /* LDV {"comment": "End of control function based on process 'random_containerless_scenario(struct_device_attribute)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_random_containerless_scenario_2"} */
185 : }
186 :
187 : /* AUX_FUNC_CALLBACK ldv_random_containerless_scenario_callback_2_10 */
188 : void ldv_random_containerless_scenario_callback_2_10(ssize_t (*arg0)(struct device *, struct device_attribute *, char *, size_t ), struct device *arg1, struct device_attribute *arg2, char *arg3, long unsigned int arg4) {
189 2 : ((& store_max_sectors))(arg1, arg2, arg3, arg4);
190 1 : }
191 :
192 : /* AUX_FUNC_CALLBACK ldv_random_containerless_scenario_callback_2_4 */
193 : void ldv_random_containerless_scenario_callback_2_4(ssize_t (*arg0)(struct device *, struct device_attribute *, char *), struct device *arg1, struct device_attribute *arg2, char *arg3) {
194 2 : ((& show_max_sectors))(arg1, arg2, arg3);
195 1 : }
196 :
197 : /* AUX_FUNC_CALLBACK ldv_scsi_LLDd_scenario_callback_1_13 */
198 : void ldv_scsi_LLDd_scenario_callback_1_13(int (*arg0)(struct scsi_cmnd *), struct scsi_cmnd *arg1) {
199 2 : ((& bus_reset))(arg1);
200 1 : }
201 :
202 : /* AUX_FUNC_CALLBACK ldv_scsi_LLDd_scenario_callback_1_14 */
203 : void ldv_scsi_LLDd_scenario_callback_1_14(int (*arg0)(struct scsi_cmnd *), struct scsi_cmnd *arg1) {
204 2 : ((& device_reset))(arg1);
205 1 : }
206 :
207 : /* AUX_FUNC_CALLBACK ldv_scsi_LLDd_scenario_callback_1_15 */
208 : void ldv_scsi_LLDd_scenario_callback_1_15(char *(*arg0)(struct Scsi_Host *), struct Scsi_Host *arg1) {
209 2 : ((& host_info))(arg1);
210 1 : }
211 :
212 : /* AUX_FUNC_CALLBACK ldv_scsi_LLDd_scenario_callback_1_16 */
213 : void ldv_scsi_LLDd_scenario_callback_1_16(int (*arg0)(struct Scsi_Host *, char *, char **, long int, int, int), struct Scsi_Host *arg1, char *arg2, char **arg3, long int arg4, int arg5, int arg6) {
214 2 : ((& proc_info))(arg1, arg2, arg3, arg4, arg5, arg6);
215 1 : }
216 :
217 : /* AUX_FUNC_CALLBACK ldv_scsi_LLDd_scenario_callback_1_19 */
218 : void ldv_scsi_LLDd_scenario_callback_1_19(int (*arg0)(struct scsi_cmnd *, void (*)(struct scsi_cmnd *)), struct scsi_cmnd *arg1, void (*arg2)(struct scsi_cmnd *)) {
219 3 : ((& queuecommand))(arg1, arg2);
220 1 : }
221 :
222 : /* AUX_FUNC_CALLBACK ldv_scsi_LLDd_scenario_callback_1_22 */
223 : void ldv_scsi_LLDd_scenario_callback_1_22(int (*arg0)(struct scsi_device *), struct scsi_device *arg1) {
224 2 : ((& slave_alloc))(arg1);
225 1 : }
226 :
227 : /* AUX_FUNC_CALLBACK ldv_scsi_LLDd_scenario_callback_1_23 */
228 : void ldv_scsi_LLDd_scenario_callback_1_23(int (*arg0)(struct scsi_device *), struct scsi_device *arg1) {
229 3 : ((& slave_configure))(arg1);
230 1 : }
231 :
232 : /* AUX_FUNC_CALLBACK ldv_scsi_LLDd_scenario_callback_1_4 */
233 : void ldv_scsi_LLDd_scenario_callback_1_4(int (*arg0)(struct scsi_cmnd *), struct scsi_cmnd *arg1) {
234 3 : ((& command_abort))(arg1);
235 1 : }
236 :
237 :
238 : /* AUX_FUNC ERR_PTR */
239 : static inline void *ERR_PTR (long int error)
240 : {
241 :
242 : return ldv_err_ptr(error);
243 : }
244 :
245 : /* AUX_FUNC PTR_ERR */
246 : static inline long int PTR_ERR (void const *ptr)
247 : {
248 :
249 : return ldv_ptr_err(ptr);
250 : }
251 :
252 : /* AUX_FUNC IS_ERR */
253 : static inline long int IS_ERR (void const *ptr)
254 : {
255 :
256 : return ldv_is_err(ptr);
257 : }
258 :
259 : /* AUX_FUNC IS_ERR_OR_NULL */
260 : static inline long int IS_ERR_OR_NULL (void const *ptr)
261 : {
262 :
263 : return ldv_is_err_or_null(ptr);
264 : }
265 :
266 : /* AUX_FUNC kzalloc */
267 : static inline void *kzalloc (size_t size, gfp_t flags)
268 : {
269 :
270 : return ldv_kzalloc(size, flags);
271 : }
272 :
273 : /* AUX_FUNC ldv_dev_get_drvdata_6 */
274 : void *ldv_dev_get_drvdata_6 (struct device const *dev)
275 : {
276 :
277 : return ldv_dev_get_drvdata(dev);
278 : }
|