]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: Tidy up verifier check_func_arg()
authorJoanne Koong <joannelkoong@gmail.com>
Tue, 12 Jul 2022 21:06:03 +0000 (14:06 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Sep 2022 09:23:58 +0000 (11:23 +0200)
commit10608641b055c4d4cc51030e09ef41aa6cddaf61
tree7dd3d390f6ed96ac71468b106949457dca0e79a9
parent840fbb6845abb5cecb0dbf417c8d265a7e791b03
bpf: Tidy up verifier check_func_arg()

[ Upstream commit 8ab4cdcf03d0b060fbf73f76460f199bbd759ff7 ]

This patch does two things:

1. For matching against the arg type, the match should be against the
base type of the arg type, since the arg type can have different
bpf_type_flags set on it.

2. Uses switch casing to improve readability + efficiency.

Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Acked-by: Hao Luo <haoluo@google.com>
Link: https://lore.kernel.org/r/20220712210603.123791-1-joannelkoong@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/verifier.c