bpf: Move sanitize_val_alu out of op switch
authorDaniel Borkmann <daniel@iogearbox.net>
Mon, 31 May 2021 18:25:46 +0000 (18:25 +0000)
committerCosmin Tanislav <demonsingur@gmail.com>
Thu, 16 May 2024 07:58:24 +0000 (10:58 +0300)
commitec76a379ee8896e14ae4a54b3fe6bccd8b381085
tree1b8c7af03872c2382888a67b2600a1dd7a315792
parent8a851afe2e7ac5bfb59f313fe6ba9bda7a26c2c5
bpf: Move sanitize_val_alu out of op switch

commit f528819334881fd622fdadeddb3f7edaed8b7c9b upstream.

Add a small sanitize_needed() helper function and move sanitize_val_alu()
out of the main opcode switch. In upcoming work, we'll move sanitize_ptr_alu()
as well out of its opcode switch so this helps to streamline both.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
[fllinden@amazon.com: backported to 4.14]
Signed-off-by: Frank van der Linden <fllinden@amazon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/bpf/verifier.c