lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Mon,  9 Jul 2018 13:48:37 +0200
From:   Tobias Tefke <tobias.tefke@...il.com>
To:     tobias.tefke@...anota.com, ast@...nel.org, daniel@...earbox.net
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] bpf: remove unnecessary condition in bpf_check()

In the label skip_full_check the function sanitize_dead_code()
is being called if the return value equals zero.
After that call there is another condition checking
if the return value equals zero.
If this condition evaluates to true,
check_max_stack_depth() is being called.
However, sanitize_dead_code() has no return value.
Therefore the return value of bpf_check() is still the same
and the condition can be removed.

Signed-off-by: Tobias Tefke <tobias.tefke@...anota.com>
---
 kernel/bpf/verifier.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 9e2bf834f13a..b022d0a85427 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -5935,11 +5935,10 @@ int bpf_check(struct bpf_prog **prog, union bpf_attr *attr)
 	while (!pop_stack(env, NULL, NULL));
 	free_states(env);
 
-	if (ret == 0)
+	if (ret == 0) {
 		sanitize_dead_code(env);
-
-	if (ret == 0)
 		ret = check_max_stack_depth(env);
+	}
 
 	if (ret == 0)
 		/* program is valid, convert *(u32*)(ctx + off) accesses */
-- 
2.18.0

Powered by blists - more mailing lists