| 2134 | } |
| 2135 | |
| 2136 | static int |
| 2137 | evst_pool_init(struct bpf_verifier *bvf) |
| 2138 | { |
| 2139 | uint32_t k, n; |
| 2140 | |
| 2141 | /* |
| 2142 | * We need nb_jcc_nodes + 1 for save_cur/restore_cur |
| 2143 | * remaining ones will be used for state tracking/pruning. |
| 2144 | */ |
| 2145 | k = bvf->nb_jcc_nodes + 1; |
| 2146 | n = k * 3; |
| 2147 | |
| 2148 | bvf->evst_sr_pool.ent = calloc(n, sizeof(bvf->evst_sr_pool.ent[0])); |
| 2149 | if (bvf->evst_sr_pool.ent == NULL) |
| 2150 | return -ENOMEM; |
| 2151 | |
| 2152 | bvf->evst_sr_pool.num = k; |
| 2153 | bvf->evst_sr_pool.cur = 0; |
| 2154 | |
| 2155 | bvf->evst_tp_pool.ent = bvf->evst_sr_pool.ent + k; |
| 2156 | bvf->evst_tp_pool.num = n - k; |
| 2157 | bvf->evst_tp_pool.cur = 0; |
| 2158 | |
| 2159 | bvf->evst = pull_eval_state(&bvf->evst_sr_pool); |
| 2160 | return 0; |
| 2161 | } |
| 2162 | |
| 2163 | /* |
| 2164 | * try to allocate and initialise new eval state for given node. |
no test coverage detected