[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2179bf7c-9878-adf7-da97-2746d5aa3d34@users.sourceforge.net>
Date: Sat, 3 Sep 2016 18:38:03 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: sparclinux@...r.kernel.org,
Adam Buchbinder <adam.buchbinder@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
"David S. Miller" <davem@...emloft.net>,
Rabin Vincent <rabin@....in>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org,
Julia Lawall <julia.lawall@...6.fr>,
Paolo Bonzini <pbonzini@...hat.com>
Subject: [PATCH 2/4] sparc: bpf_jit: Move four assignments in
bpf_jit_compile()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 3 Sep 2016 17:45:28 +0200
Move the assignments for four local variables a bit at the beginning
so that they will only be performed if a corresponding memory allocation
succeeded by this function.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
arch/sparc/net/bpf_jit_comp.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/arch/sparc/net/bpf_jit_comp.c b/arch/sparc/net/bpf_jit_comp.c
index ced1393..a927470 100644
--- a/arch/sparc/net/bpf_jit_comp.c
+++ b/arch/sparc/net/bpf_jit_comp.c
@@ -362,10 +362,10 @@ do { *prog++ = BR_OPC | WDISP22(OFF); \
void bpf_jit_compile(struct bpf_prog *fp)
{
- unsigned int cleanup_addr, proglen, oldproglen = 0;
- u32 temp[8], *prog, *func, seen = 0, pass;
- const struct sock_filter *filter = fp->insns;
- int i, flen = fp->len, pc_ret0 = -1;
+ unsigned int cleanup_addr, proglen, oldproglen;
+ u32 temp[8], *prog, *func, seen, pass;
+ const struct sock_filter *filter;
+ int i, flen = fp->len, pc_ret0;
unsigned int *addrs;
void *image;
@@ -385,6 +385,10 @@ void bpf_jit_compile(struct bpf_prog *fp)
}
cleanup_addr = proglen; /* epilogue address */
image = NULL;
+ filter = fp->insns;
+ oldproglen = 0;
+ pc_ret0 = -1;
+ seen = 0;
for (pass = 0; pass < 10; pass++) {
u8 seen_or_pass0 = (pass == 0) ? (SEEN_XREG | SEEN_DATAREF | SEEN_MEM) : seen;
--
2.9.3
Powered by blists - more mailing lists