A later patch tags the functions that return ERR_PTR(). check_fmodret_retval() compares the return value in 32 bits if t->size of the return type is 4. For a pointer t->size is the id of the type it points to. Compare it in 64 bits as for long. Signed-off-by: Anton Protopopov --- kernel/bpf/verifier.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index d2475edeecd9..8e866f3ea7f4 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -19903,9 +19903,11 @@ static int check_fmodret_retval(struct bpf_verifier_env *env, int regno, * * The trampolines of x86-64, arm64 and s390x do that: look here before * another architecture is added to CONFIG_BPF_FMODRET_SCAN. + * + * A pointer is compared in 64 bits. Its t->size is the id of the type it points to. */ t = btf_type_skip_modifiers(aux->attach_btf, aux->attach_func_proto->type, NULL); - if (t->size == 4 && reg_umax(reg) <= U32_MAX) { + if (!btf_type_is_ptr(t) && t->size == 4 && reg_umax(reg) <= U32_MAX) { smin = reg_s32_min(reg); smax = reg_s32_max(reg); } -- 2.43.0