Lines Matching refs:reg
6199 const struct bpf_reg_state *reg) in is_kfunc_arg_mem_size() argument
6206 if (!btf_type_is_scalar(t) || reg->type != SCALAR_VALUE) in is_kfunc_arg_mem_size()
6225 const struct bpf_reg_state *reg, in btf_is_kfunc_arg_mem_size() argument
6233 if (!btf_type_is_scalar(t) || reg->type != SCALAR_VALUE) in btf_is_kfunc_arg_mem_size()
6304 struct bpf_reg_state *reg = ®s[regno]; in btf_check_func_arg_match() local
6315 if (btf_is_kfunc_arg_mem_size(btf, &args[i], reg, in btf_check_func_arg_match()
6319 } else if (btf_is_kfunc_arg_mem_size(btf, &args[i], reg, in btf_check_func_arg_match()
6329 if (!tnum_is_const(reg->var_off)) { in btf_check_func_arg_match()
6334 kfunc_meta->r0_size = reg->var_off.value; in btf_check_func_arg_match()
6341 if (reg->type == SCALAR_VALUE) in btf_check_func_arg_match()
6356 obj_ptr = reg->type == PTR_TO_CTX || reg->type == PTR_TO_BTF_ID || in btf_check_func_arg_match()
6357 reg2btf_ids[base_type(reg->type)]; in btf_check_func_arg_match()
6363 if (is_kfunc && trusted_args && (obj_ptr && reg->type != PTR_TO_CTX) && !reg->ref_obj_id) { in btf_check_func_arg_match()
6372 if ((trusted_args && obj_ptr) || (rel && reg->ref_obj_id)) in btf_check_func_arg_match()
6374 ret = check_func_arg_reg_off(env, reg, regno, arg_type); in btf_check_func_arg_match()
6378 if (is_kfunc && reg->ref_obj_id) { in btf_check_func_arg_match()
6382 regno, reg->ref_obj_id, ref_obj_id); in btf_check_func_arg_match()
6386 ref_obj_id = reg->ref_obj_id; in btf_check_func_arg_match()
6393 if (reg->type != PTR_TO_MAP_VALUE) { in btf_check_func_arg_match()
6402 if (!tnum_is_const(reg->var_off)) { in btf_check_func_arg_match()
6407 off_desc = bpf_map_kptr_off_contains(reg->map_ptr, reg->off + reg->var_off.value); in btf_check_func_arg_match()
6410 reg->off + reg->var_off.value); in btf_check_func_arg_match()
6438 if (reg->type != PTR_TO_CTX) { in btf_check_func_arg_match()
6444 } else if (is_kfunc && (reg->type == PTR_TO_BTF_ID || in btf_check_func_arg_match()
6445 (reg2btf_ids[base_type(reg->type)] && !type_flag(reg->type)))) { in btf_check_func_arg_match()
6458 if (reg->type == PTR_TO_BTF_ID) { in btf_check_func_arg_match()
6459 reg_btf = reg->btf; in btf_check_func_arg_match()
6460 reg_ref_id = reg->btf_id; in btf_check_func_arg_match()
6463 reg_ref_id = *reg2btf_ids[base_type(reg->type)]; in btf_check_func_arg_match()
6471 reg->off, btf, ref_id, in btf_check_func_arg_match()
6472 trusted_args || (rel && reg->ref_obj_id))) { in btf_check_func_arg_match()
6508 if (reg->type != PTR_TO_STACK) { in btf_check_func_arg_match()
6515 if (!is_dynptr_reg_valid_init(env, reg)) { in btf_check_func_arg_match()
6523 if (!is_dynptr_type_expected(env, reg, in btf_check_func_arg_match()
6556 if (check_mem_reg(env, reg, regno, type_size)) in btf_check_func_arg_match()
6759 struct bpf_reg_state *reg = ®s[i + 1]; in btf_prepare_func_args() local
6765 reg->type = SCALAR_VALUE; in btf_prepare_func_args()
6770 reg->type = PTR_TO_CTX; in btf_prepare_func_args()
6776 ref_t = btf_resolve_size(btf, t, ®->mem_size); in btf_prepare_func_args()
6785 reg->type = PTR_TO_MEM | PTR_MAYBE_NULL; in btf_prepare_func_args()
6786 reg->id = ++env->id_gen; in btf_prepare_func_args()