* try to allocate and initialise new eval state for given node. * later if no errors will be encountered, this state will be accepted as * one of the possible 'safe' states for that node. */
| 2166 | * one of the possible 'safe' states for that node. |
| 2167 | */ |
| 2168 | static void |
| 2169 | save_start_eval_state(struct bpf_verifier *bvf, struct inst_node *node) |
| 2170 | { |
| 2171 | RTE_ASSERT(node->evst.start == NULL); |
| 2172 | |
| 2173 | /* limit number of states for one node with some reasonable value */ |
| 2174 | if (node->evst.nb_safe >= NODE_EVST_MAX) |
| 2175 | return; |
| 2176 | |
| 2177 | /* try to get new eval_state */ |
| 2178 | node->evst.start = pull_eval_state(&bvf->evst_tp_pool); |
| 2179 | |
| 2180 | /* make a copy of current state */ |
| 2181 | if (node->evst.start != NULL) { |
| 2182 | memcpy(node->evst.start, bvf->evst, sizeof(*node->evst.start)); |
| 2183 | SLIST_NEXT(node->evst.start, next) = NULL; |
| 2184 | } |
| 2185 | } |
| 2186 | |
| 2187 | /* |
| 2188 | * add @start state to the list of @safe states. |
no test coverage detected