Skip to contentSkip to conversation

s390/bpf: remove redundant check for non-null image

PATCH Michael Holzheu 1 participant 1 message Jan 24, 2017 1 message not in the archive s390

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20170114105739.GB6789@osiris

#1 lore raw

Am Sat, 14 Jan 2017 01:48:24 +0100
schrieb Daniel Borkmann <[email protected]>:

Quoted 26 lines

After we already allocated the jit.prg_buf image via bpf_jit_binary_alloc() and filled it out with instructions, jit.prg_buf cannot be NULL anymore. Thus, remove the unnecessary check. Tested on s390x with test_bpf module.

Cc Michael Holzheu <[email protected]>
Cc Martin Schwidefsky <[email protected]>
---
 arch/s390/net/bpf_jit_comp.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
arch/s390/net/bpf_jit_comp.c +0 -6
index 167b31b..b4272cd 100644
@@ -1331,14 +1331,12 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 	}
 	if (bpf_jit_enable > 1) {
 		bpf_jit_dump(fp->len, jit.size, pass, jit.prg_buf);
-		if (jit.prg_buf)
-			print_fn_code(jit.prg_buf, jit.size_prg);
-	}
-	if (jit.prg_buf) {
-		set_memory_ro((unsigned long)header, header->pages);
-		fp->bpf_func = (void *) jit.prg_buf;

arch/s390/net/bpf_jit_comp.c struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp) · line 1342

Quoted 10 lines
arch/s390/net/bpf_jit_comp.c +5 -1
-		fp->jited = 1;
+		print_fn_code(jit.prg_buf, jit.size_prg);
 	}
+
+	set_memory_ro((unsigned long)header, header->pages);
+	fp->bpf_func = (void *) jit.prg_buf;
+	fp->jited = 1;
 free_addrs:
 	kfree(jit.addrs);
 out:

Makes sense, thanks!

Michael