Skip to contentSkip to conversation

bpf: Remove unused but set variables

PATCH Applied Tobias Klauser 3 participants 3 messages Nov 8, 2016 – Nov 10, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: Remove unused but set variables

Remove the unused but set variables min_set and max_set in adjust_reg_min_max_vals to fix the following warning when building with 'W=1':

kernel/bpf/verifier.c:1483:7: warning: variable ‘min_set’ set but not used [-Wunused-but-set-variable]

There is no warning about max_set being unused, but since it is only used in the assignment of min_set it can be removed as well.

They were introduced in commit 484611357c19 ("bpf: allow access into map value arrays") but seem to have never been used.

---
 kernel/bpf/verifier.c | 2 --
 1 file changed, 2 deletions(-)
kernel/bpf/verifier.c +0 -2
index 846d7ceaf202..14345be4a2d2 100644
@@ -1480,7 +1480,6 @@ static void adjust_reg_min_max_vals(struct bpf_verifier_env *env,
 {
 	struct bpf_reg_state *regs = env->cur_state.regs, *dst_reg;
 	u64 min_val = BPF_REGISTER_MIN_RANGE, max_val = BPF_REGISTER_MAX_RANGE;
-	bool min_set = false, max_set = false;
 	u8 opcode = BPF_OP(insn->code);
 
 	dst_reg = &regs[insn->dst_reg];
@@ -1503,7 +1502,6 @@ static void adjust_reg_min_max_vals(struct bpf_verifier_env *env,
 	} else if (insn->imm < BPF_REGISTER_MAX_RANGE &&
 		   (s64)insn->imm > BPF_REGISTER_MIN_RANGE) {
 		min_val = max_val = insn->imm;
-		min_set = max_set = true;
 	}
 
 	/* We don't know anything about what was done to this register, mark it
Signature · 1 line
2.9.0
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Tobias Klauser

Remove the unused but set variables min_set and max_set in adjust_reg_min_max_vals to fix the following warning when building with 'W=1':

kernel/bpf/verifier.c:1483:7: warning: variable ‘min_set’ set but not used [-Wunused-but-set-variable]

There is no warning about max_set being unused, but since it is only used in the assignment of min_set it can be removed as well.

Quoted 6 lines

They were introduced in commit 484611357c19 ("bpf: allow access into map value arrays") but seem to have never been used.

---

maintainer Applied
#2 lore raw
In reply to Tobias Klauser

From: Tobias Klauser <[email protected]>
Date: Tue, 8 Nov 2016 16:40:28 +0100

Quoted 6 lines

Remove the unused but set variables min_set and max_set in adjust_reg_min_max_vals to fix the following warning when building with 'W=1':

kernel/bpf/verifier.c:1483:7: warning: variable ‘min_set’ set but not used [-Wunused-but-set-variable]

Quoted 8 lines

There is no warning about max_set being unused, but since it is only used in the assignment of min_set it can be removed as well.

They were introduced in commit 484611357c19 ("bpf: allow access into map value arrays") but seem to have never been used.

Applied to net-next, thanks.