]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Refactor check_cfg to use a structured loop.
authorWedson Almeida Filho <wedsonaf@google.com>
Sat, 21 Nov 2020 01:55:09 +0000 (01:55 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 25 Nov 2020 04:29:26 +0000 (20:29 -0800)
commit2d5c4603c74a50d04b16ca02d8e7aa7cfcb70de0
tree6ae4ae1dadba03d270b2214ea6aa25ee9e0b3d27
parent19c9dfaca77248b3d8ca1cdb7be776f0011a686e
bpf: Refactor check_cfg to use a structured loop.

The current implementation uses a number of gotos to implement a loop
and different paths within the loop, which makes the code less readable
than it would be with an explicit while-loop. This patch also replaces a
chain of if/if-elses keyed on the same expression with a switch
statement.

No change in behaviour is intended.

Signed-off-by: Wedson Almeida Filho <wedsonaf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201121015509.3594191-1-wedsonaf@google.com
kernel/bpf/verifier.c