diff mbox series

[next] bpf: remove redundant initialization of variable allow

Message ID 20210817170842.495440-1-colin.king@canonical.com (mailing list archive)
State Accepted
Delegated to: BPF
Headers show
Series [next] bpf: remove redundant initialization of variable allow | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Colin King Aug. 17, 2021, 5:08 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

The variable allow is being initialized with a value that is never read, it
is being updated later on. The assignment is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 kernel/bpf/cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
index a1dedba4c174..9f35928bab0a 100644
--- a/kernel/bpf/cgroup.c
+++ b/kernel/bpf/cgroup.c
@@ -1133,11 +1133,11 @@  int __cgroup_bpf_check_dev_permission(short dev_type, u32 major, u32 minor,
 	struct bpf_cgroup_dev_ctx ctx = {
 		.access_type = (access << 16) | dev_type,
 		.major = major,
 		.minor = minor,
 	};
-	int allow = 1;
+	int allow;
 
 	rcu_read_lock();
 	cgrp = task_dfl_cgroup(current);
 	allow = BPF_PROG_RUN_ARRAY_CG(cgrp->bpf.effective[type], &ctx,
 				      bpf_prog_run);