MCPcopy Create free account
hub / github.com/F-Stack/f-stack / eval_func_arg

Function eval_func_arg

dpdk/lib/bpf/bpf_validate.c:944–986  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

942}
943
944static const char *
945eval_func_arg(struct bpf_verifier *bvf, const struct rte_bpf_arg *arg,
946 struct bpf_reg_val *rv)
947{
948 uint32_t i, n;
949 struct bpf_eval_state *st;
950 const char *err;
951
952 st = bvf->evst;
953
954 if (rv->v.type == RTE_BPF_ARG_UNDEF)
955 return "Undefined argument type";
956
957 if (arg->type != rv->v.type &&
958 arg->type != RTE_BPF_ARG_RAW &&
959 (arg->type != RTE_BPF_ARG_PTR ||
960 RTE_BPF_ARG_PTR_TYPE(rv->v.type) == 0))
961 return "Invalid argument type";
962
963 err = NULL;
964
965 /* argument is a pointer */
966 if (RTE_BPF_ARG_PTR_TYPE(arg->type) != 0) {
967
968 err = eval_ptr(bvf, rv, arg->size, 1, 0);
969
970 /*
971 * pointer to the variable on the stack is passed
972 * as an argument, mark stack space it occupies as initialized.
973 */
974 if (err == NULL && rv->v.type == BPF_ARG_PTR_STACK) {
975
976 i = rv->u.max / sizeof(uint64_t);
977 n = i + arg->size / sizeof(uint64_t);
978 while (i != n) {
979 eval_fill_max_bound(st->sv + i, UINT64_MAX);
980 i++;
981 };
982 }
983 }
984
985 return err;
986}
987
988static const char *
989eval_call(struct bpf_verifier *bvf, const struct ebpf_insn *ins)

Callers 1

eval_callFunction · 0.85

Calls 2

eval_ptrFunction · 0.85
eval_fill_max_boundFunction · 0.85

Tested by

no test coverage detected