LCOV - code coverage report
Current view: top level - avtg/fs/configfs/configfs.ko/linux:drivers:clk2/weaver - file.c.aux (source / functions) Hit Total Coverage
Test: coverage.info Lines: 95 97 97.9 %
Date: 2017-01-25 Functions: 6 6 100.0 %

          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_8 {
      35             :  int signal_pending;
      36             : };
      37             : 
      38             : struct ldv_struct_random_containerless_scenario_5 {
      39             :  struct file_system_type *arg0;
      40             :  int signal_pending;
      41             : };
      42             : 
      43             : /* EMG Function declarations */
      44             : void ldv_character_driver_scenario_2(void *);
      45             : void ldv_character_driver_scenario_callback_2_22(ssize_t (*)(struct file *, char *, size_t , loff_t *), struct file *, char *, long unsigned int, loff_t *);
      46             : extern void ldv_character_driver_scenario_callback_2_25(int (*)(struct file *, void *, filldir_t ), struct file *, void *, int (*)(void *, char *, int, loff_t , u64 , unsigned int));
      47             : void ldv_character_driver_scenario_callback_2_5(loff_t (*)(struct file *, loff_t , int), struct file *, long long int, int);
      48             : int ldv_character_driver_scenario_probe_2_13(int (*)(struct inode *, struct file *), struct inode *, struct file *);
      49             : void ldv_character_driver_scenario_release_2_2(int (*)(struct inode *, struct file *), struct inode *, struct file *);
      50             : void ldv_character_driver_scenario_write_2_4(ssize_t (*)(struct file *, char *, size_t , loff_t *), struct file *, char *, long unsigned int, loff_t *);
      51             : 
      52             : /* EMG variable declarations */
      53           1 : struct ldv_thread ldv_thread_2;
      54             : 
      55             : /* EMG variable initialization */
      56             : 
      57             : /* EMG function definitions */
      58             : /* AUX_FUNC ldv_character_driver_scenario_2 */
      59             : void ldv_character_driver_scenario_2(void *arg0) {
      60             :  /* LDV {"thread": 2, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'character_driver_scenario(file_operations)'", "function": "ldv_character_driver_scenario_2"} */
      61           1 :  /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
      62           1 :  loff_t (*ldv_2_callback_llseek)(struct file *, loff_t , int);
      63           1 :  ssize_t (*ldv_2_callback_read)(struct file *, char *, size_t , loff_t *);
      64             :  int (*ldv_2_callback_readdir)(struct file *, void *, filldir_t );
      65             :  struct file_operations *ldv_2_container_file_operations;
      66           1 :  char *ldv_2_ldv_param_22_1_default;
      67           1 :  long long int *ldv_2_ldv_param_22_3_default;
      68           1 :  char *ldv_2_ldv_param_4_1_default;
      69           1 :  long long int *ldv_2_ldv_param_4_3_default;
      70           1 :  long long int ldv_2_ldv_param_5_1_default;
      71           1 :  int ldv_2_ldv_param_5_2_default;
      72           1 :  struct file *ldv_2_resource_file;
      73           1 :  struct inode *ldv_2_resource_inode;
      74           1 :  int ldv_2_ret_default;
      75           1 :  int (*ldv_2_size_cnt_func_1_ptr)(void *, char *, int, loff_t , u64 , unsigned int);
      76           1 :  long unsigned int ldv_2_size_cnt_write_size;
      77           1 :  /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
      78           1 :  /* Initialize automaton variables */
      79           2 :  ldv_2_ret_default = 1;
      80           1 :  /* LDV {"action": "DEFAULT_REGISTER_1", "type": "RECEIVE_BEGIN", "comment": "Begin FILE_OPERATIONS callbacks invocations scenario."} */
      81           3 :  ldv_free(arg0);
      82           1 :  /* LDV {"action": "DEFAULT_REGISTER_1", "type": "RECEIVE_END"} */
      83           1 : 
      84           1 :  /* LDV {"action": "DEFAULT_ALLOC_1", "type": "CONDITION_BEGIN", "comment": "Allocate memory after default registration."} */
      85           4 :  ldv_2_container_file_operations = ldv_xmalloc_unknown_size(0);
      86           1 :  /* LDV {"action": "DEFAULT_ALLOC_1", "type": "CONDITION_END"} */
      87           1 : 
      88           1 :  /* LDV {"action": "INIT", "type": "CONDITION_BEGIN", "comment": "Allocate memory for file and inode structures."} */
      89           4 :  ldv_2_resource_file = ldv_xmalloc(sizeof(struct file));
      90           3 :  ldv_2_resource_inode = ldv_xmalloc(sizeof(struct inode));
      91           3 :  ldv_2_size_cnt_func_1_ptr = ldv_undef_int();
      92             :  /* LDV {"action": "INIT", "type": "CONDITION_END"} */
      93             : 
      94             :  /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Device appeared in the system."} */
      95             :  /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
      96             : 
      97             :  /* Jump to a subprocess 'main' initial state */
      98           1 :  goto ldv_main_2;
      99             :  /* End of the process */
     100             :  return;
     101           1 : 
     102             :  /* Sbprocess main */
     103             :  ldv_main_2:
     104             :  /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
     105             : 
     106           4 :  if (ldv_undef_int()) {
     107             :   /* LDV {"action": "PROBE", "type": "CALL_BEGIN", "callback": true, "comment": "Open the device file. Invoke callback open from file_operations."} */
     108             :   /* LDV {"type": "CALLBACK", "call": "ldv_2_ret_default = ((& configfs_open_file))(ldv_2_resource_inode, ldv_2_resource_file);", "comment": "probe"} */
     109           2 :   ldv_2_ret_default = ldv_character_driver_scenario_probe_2_13(ldv_2_container_file_operations->open, ldv_2_resource_inode, ldv_2_resource_file);
     110             :   /* Callback post-call */
     111           2 :   ldv_2_ret_default = ldv_filter_err_code(ldv_2_ret_default);
     112             :   /* LDV {"action": "PROBE", "type": "CALL_END"} */
     113             : 
     114           4 :   if (ldv_undef_int()) {
     115             :    /* LDV {"action": "PROBE_SUCCESS", "type": "CONDITION_BEGIN", "comment": "Device file is opened successfully."} */
     116           2 :    ldv_assume(ldv_2_ret_default == 0);
     117             :    /* LDV {"action": "PROBE_SUCCESS", "type": "CONDITION_END"} */
     118             : 
     119             :    /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Device file is opened, ready to read and write."} */
     120             :    /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
     121             : 
     122             :    /* Jump to a subprocess 'call' initial state */
     123           1 :    goto ldv_call_2;
     124             :   }
     125             :   else {
     126             :    /* LDV {"action": "PROBE_FAIL", "type": "CONDITION_BEGIN", "comment": "Failed to open devices file."} */
     127           2 :    ldv_assume(ldv_2_ret_default != 0);
     128             :    /* LDV {"action": "PROBE_FAIL", "type": "CONDITION_END"} */
     129             : 
     130             :    /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Device appeared in the system."} */
     131             :    /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
     132             : 
     133             :    /* Jump to a subprocess 'main' initial state */
     134           1 :    goto ldv_main_2;
     135             :   }
     136             :  }
     137             :  else {
     138             :   /* LDV {"action": "FREE", "type": "CONDITION_BEGIN", "comment": "Free memory of file and inode structures."} */
     139           2 :   ldv_free(ldv_2_resource_file);
     140           2 :   ldv_free(ldv_2_resource_inode);
     141             :   /* LDV {"action": "FREE", "type": "CONDITION_END"} */
     142             : 
     143             :   /* LDV {"action": "DEFAULT_FREE_1", "type": "CONDITION_BEGIN", "comment": "Free memory before default deregistration."} */
     144           2 :   ldv_free(ldv_2_container_file_operations);
     145             :   /* LDV {"action": "DEFAULT_FREE_1", "type": "CONDITION_END"} */
     146             : 
     147             :   /* LDV {"action": "DEFAULT_DEREGISTER_1", "type": "RECEIVE_BEGIN", "comment": "Finish FILE_OPERATIONS callbacks invocations scenario."} */
     148             :   /* Skip a non-replicative signal receiving */
     149             :   /* LDV {"action": "DEFAULT_DEREGISTER_1", "type": "RECEIVE_END"} */
     150             : 
     151             :   /* Exit function at a terminal state */
     152           1 :   return;
     153             :  }
     154             :  /* End of the subprocess 'main' */
     155             :  return;
     156           1 : 
     157             :  /* Sbprocess call */
     158             :  ldv_call_2:
     159             :  /* LDV {"action": null, "type": "ARTIFICIAL", "comment": "Artificial state in scenario"} */
     160             : 
     161           2 :  switch (ldv_undef_int()) {
     162           3 :   case 1: {
     163             :    /* LDV {"action": "PRE_CALL_4", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
     164           3 :    ldv_2_ldv_param_4_1_default = ldv_xmalloc_unknown_size(0);
     165           3 :    ldv_2_ldv_param_4_3_default = ldv_xmalloc_unknown_size(0);
     166             :    /* LDV {"action": "PRE_CALL_4", "type": "CONDITION_END"} */
     167             : 
     168             :    /* LDV {"action": "WRITE", "type": "CALL_BEGIN", "callback": true, "comment": "Write data to the device. Invoke callback write from file_operations."} */
     169             :    /* Callback pre-call */
     170           2 :    ldv_assume(ldv_2_size_cnt_func_1_ptr <= (INT_MAX & PAGE_CACHE_MASK));
     171             :    /* LDV {"type": "CALLBACK", "call": "((& configfs_write_file))(ldv_2_resource_file, ldv_2_ldv_param_4_1_default, ldv_2_size_cnt_write_size, ldv_2_ldv_param_4_3_default);", "comment": "write"} */
     172           3 :    ldv_character_driver_scenario_write_2_4(ldv_2_container_file_operations->write, ldv_2_resource_file, ldv_2_ldv_param_4_1_default, ldv_2_size_cnt_write_size, ldv_2_ldv_param_4_3_default);
     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           2 :    ldv_free(ldv_2_ldv_param_4_1_default);
     177           2 :    ldv_free(ldv_2_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_2;
     185           1 :    break;
     186             :   }
     187           3 :   case 2: {
     188             :    /* LDV {"action": "RELEASE", "type": "CALL_BEGIN", "callback": true, "comment": "File structure is released. Invoke callback release from file_operations."} */
     189             :    /* LDV {"type": "CALLBACK", "call": "((& configfs_release))(ldv_2_resource_inode, ldv_2_resource_file);", "comment": "release"} */
     190           2 :    ldv_character_driver_scenario_release_2_2(ldv_2_container_file_operations->release, ldv_2_resource_inode, ldv_2_resource_file);
     191             :    /* LDV {"action": "RELEASE", "type": "CALL_END"} */
     192             : 
     193             :    /* LDV {"action": "MAIN", "type": "SUBPROCESS_BEGIN", "comment": "Device appeared in the system."} */
     194             :    /* LDV {"action": "MAIN", "type": "SUBPROCESS_END"} */
     195             : 
     196             :    /* Jump to a subprocess 'main' initial state */
     197           1 :    goto ldv_main_2;
     198           1 :    break;
     199             :   }
     200           3 :   case 3: {
     201             :    /* LDV {"action": "PRE_CALL_5", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
     202             :    /* LDV {"action": "PRE_CALL_5", "type": "CONDITION_END"} */
     203             : 
     204           2 :    switch (ldv_undef_int()) {
     205           3 :     case 1: {
     206             :      /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback callback from FILE_OPERATIONS."} */
     207           2 :      if (ldv_2_callback_readdir) {
     208             :      /* LDV {"type": "CALLBACK", "call": "(ldv_2_callback_readdir)(ldv_2_resource_file, ldv_2_resource_inode, ldv_2_size_cnt_func_1_ptr);", "comment": "callback"} */
     209           2 :       ldv_character_driver_scenario_callback_2_25(ldv_2_callback_readdir, ldv_2_resource_file, ldv_2_resource_inode, ldv_2_size_cnt_func_1_ptr);
     210             :      }
     211             :      /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
     212             : 
     213           2 :      break;
     214           1 :     }
     215           3 :     case 2: {
     216             :      /* LDV {"action": "PRE_CALL_22", "type": "CONDITION_BEGIN", "comment": "Allocate memory for adhoc callback parameters."} */
     217           3 :      ldv_2_ldv_param_22_1_default = ldv_xmalloc_unknown_size(0);
     218           3 :      ldv_2_ldv_param_22_3_default = ldv_xmalloc_unknown_size(0);
     219             :      /* LDV {"action": "PRE_CALL_22", "type": "CONDITION_END"} */
     220             : 
     221             :      /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback read from file_operations."} */
     222             :      /* LDV {"type": "CALLBACK", "call": "((& configfs_read_file))(ldv_2_resource_file, ldv_2_ldv_param_22_1_default, ldv_2_size_cnt_write_size, ldv_2_ldv_param_22_3_default);", "comment": "callback"} */
     223           2 :      ldv_character_driver_scenario_callback_2_22(ldv_2_callback_read, ldv_2_resource_file, ldv_2_ldv_param_22_1_default, ldv_2_size_cnt_write_size, ldv_2_ldv_param_22_3_default);
     224             :      /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
     225             : 
     226             :      /* LDV {"action": "POST_CALL_22", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
     227           2 :      ldv_free(ldv_2_ldv_param_22_1_default);
     228           2 :      ldv_free(ldv_2_ldv_param_22_3_default);
     229             :      /* LDV {"action": "POST_CALL_22", "type": "CONDITION_END"} */
     230             : 
     231           1 :      break;
     232           1 :     }
     233           3 :     case 3: {
     234             :      /* LDV {"action": "CALLBACK", "type": "CALL_BEGIN", "callback": true, "comment": "Invoke callback llseek from file_operations."} */
     235             :      /* LDV {"type": "CALLBACK", "call": "((& generic_file_llseek))(ldv_2_resource_file, ldv_2_ldv_param_5_1_default, ldv_2_ldv_param_5_2_default);", "comment": "callback"} */
     236           2 :      ldv_character_driver_scenario_callback_2_5(ldv_2_callback_llseek, ldv_2_resource_file, ldv_2_ldv_param_5_1_default, ldv_2_ldv_param_5_2_default);
     237             :      /* LDV {"action": "CALLBACK", "type": "CALL_END"} */
     238             : 
     239           1 :      break;
     240           1 :     }
     241           2 :     default: ldv_stop();
     242           1 :    }
     243           4 :    break;
     244           1 :   }
     245           2 :   default: ldv_stop();
     246           1 :  }
     247           0 :  /* LDV {"action": "POST_CALL_5", "type": "CONDITION_BEGIN", "comment": "Free memory of adhoc callback parameters."} */
     248             :  /* LDV {"action": "POST_CALL_5", "type": "CONDITION_END"} */
     249           0 : 
     250             :  /* LDV {"action": "CALL", "type": "SUBPROCESS_BEGIN", "comment": "Device file is opened, ready to read and write."} */
     251             :  /* LDV {"action": "CALL", "type": "SUBPROCESS_END"} */
     252             : 
     253             :  /* Jump to a subprocess 'call' initial state */
     254           4 :  goto ldv_call_2;
     255             :  /* Jump to a subprocess 'call' initial state */
     256             :  goto ldv_call_2;
     257             :  /* End of the subprocess 'call' */
     258             :  return;
     259             :  /* LDV {"comment": "End of control function based on process 'character_driver_scenario(file_operations)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_character_driver_scenario_2"} */
     260             : }
     261             : 
     262             : /* AUX_FUNC_CALLBACK ldv_character_driver_scenario_callback_2_22 */
     263             : void ldv_character_driver_scenario_callback_2_22(ssize_t (*arg0)(struct file *, char *, size_t , loff_t *), struct file *arg1, char *arg2, long unsigned int arg3, long long int *arg4) {
     264           3 :  ((& configfs_read_file))(arg1, arg2, arg3, arg4);
     265           1 : }
     266             : 
     267             : /* AUX_FUNC_CALLBACK ldv_character_driver_scenario_callback_2_5 */
     268             : void ldv_character_driver_scenario_callback_2_5(loff_t (*arg0)(struct file *, loff_t , int), struct file *arg1, long long int arg2, int arg3) {
     269           1 :  ((& generic_file_llseek))(arg1, arg2, arg3);
     270           1 : }
     271             : 
     272             : /* AUX_FUNC_CALLBACK ldv_character_driver_scenario_probe_2_13 */
     273             : int ldv_character_driver_scenario_probe_2_13(int (*arg0)(struct inode *, struct file *), struct inode *arg1, struct file *arg2) {
     274           3 :  return ((& configfs_open_file))(arg1, arg2);
     275             : }
     276           1 : 
     277             : /* AUX_FUNC_CALLBACK ldv_character_driver_scenario_release_2_2 */
     278             : void ldv_character_driver_scenario_release_2_2(int (*arg0)(struct inode *, struct file *), struct inode *arg1, struct file *arg2) {
     279           2 :  ((& configfs_release))(arg1, arg2);
     280           1 : }
     281             : 
     282             : /* AUX_FUNC_CALLBACK ldv_character_driver_scenario_write_2_4 */
     283             : void ldv_character_driver_scenario_write_2_4(ssize_t (*arg0)(struct file *, char *, size_t , loff_t *), struct file *arg1, char *arg2, long unsigned int arg3, long long int *arg4) {
     284           3 :  ((& configfs_write_file))(arg1, arg2, arg3, arg4);
     285           1 : }
     286             : 
     287             : 
     288             : /* AUX_FUNC  ERR_PTR */
     289             : static inline void *ERR_PTR (long int error)
     290             : {
     291             : 
     292             :  return ldv_err_ptr(error);
     293             : }
     294             : 
     295             : /* AUX_FUNC  PTR_ERR */
     296             : static inline long int PTR_ERR (void const *ptr)
     297             : {
     298             : 
     299             :  return ldv_ptr_err(ptr);
     300             : }
     301             : 
     302             : /* AUX_FUNC  IS_ERR */
     303             : static inline long int IS_ERR (void const *ptr)
     304             : {
     305             : 
     306             :  return ldv_is_err(ptr);
     307             : }
     308             : 
     309             : /* AUX_FUNC  IS_ERR_OR_NULL */
     310             : static inline long int IS_ERR_OR_NULL (void const *ptr)
     311             : {
     312             : 
     313             :  return ldv_is_err_or_null(ptr);
     314             : }
     315             : 
     316             : /* AUX_FUNC  kzalloc */
     317             : static inline void *kzalloc (size_t size, gfp_t flags)
     318             : {
     319             : 
     320             :  return ldv_kzalloc(size, flags);
     321             : }

Generated by: LCOV version 1.10