mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
arch/mips/net/bpf_jit.c: fix failure check
static int pkt_type_offset(void) returned -1 in case of failure, and actual (positive) offset value in case of success. In the only instance of its usage, the result was saved to local "unsigned int off" variable, which is used in a lot of places in the same (large) function, so changing its type could cause many warnings. So new signed int variable was added. Signed-off-by: Andrey Utkin <andrey.krieger.utkin@gmail.com> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=80371 Reported-by: David Binderman <dcb314@hotmail.com> Cc: linux-kernel@vger.kernel.org Cc: kernel-janitors@vger.kernel.org Cc: linux-mips@linux-mips.org Cc: dborkman@redhat.com Cc: markos.chandras@imgtec.com Patchwork: https://patchwork.linux-mips.org/patch/7380/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
This commit is contained in:
parent
68c77d8a1e
commit
98fb24af5e
1 changed files with 3 additions and 2 deletions
|
@ -793,6 +793,7 @@ static int build_body(struct jit_ctx *ctx)
|
||||||
const struct sock_filter *inst;
|
const struct sock_filter *inst;
|
||||||
unsigned int i, off, load_order, condt;
|
unsigned int i, off, load_order, condt;
|
||||||
u32 k, b_off __maybe_unused;
|
u32 k, b_off __maybe_unused;
|
||||||
|
int tmp;
|
||||||
|
|
||||||
for (i = 0; i < prog->len; i++) {
|
for (i = 0; i < prog->len; i++) {
|
||||||
u16 code;
|
u16 code;
|
||||||
|
@ -1332,9 +1333,9 @@ static int build_body(struct jit_ctx *ctx)
|
||||||
case BPF_ANC | SKF_AD_PKTTYPE:
|
case BPF_ANC | SKF_AD_PKTTYPE:
|
||||||
ctx->flags |= SEEN_SKB;
|
ctx->flags |= SEEN_SKB;
|
||||||
|
|
||||||
off = pkt_type_offset();
|
tmp = off = pkt_type_offset();
|
||||||
|
|
||||||
if (off < 0)
|
if (tmp < 0)
|
||||||
return -1;
|
return -1;
|
||||||
emit_load_byte(r_tmp, r_skb, off, ctx);
|
emit_load_byte(r_tmp, r_skb, off, ctx);
|
||||||
/* Keep only the last 3 bits */
|
/* Keep only the last 3 bits */
|
||||||
|
|
Loading…
Reference in a new issue