Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net In some implementations pc->k is signed. Cast it to ...
details: https://anonhg.NetBSD.org/src/rev/46363e0d51e7
branches: trunk
changeset: 336161:46363e0d51e7
user: alnsn <alnsn%NetBSD.org@localhost>
date: Sat Feb 14 21:17:05 2015 +0000
description:
In some implementations pc->k is signed. Cast it to uint32_t before comparing.
diffstat:
sys/net/bpfjit.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diffs (40 lines):
diff -r bb3f3fe477ea -r 46363e0d51e7 sys/net/bpfjit.c
--- a/sys/net/bpfjit.c Sat Feb 14 21:14:56 2015 +0000
+++ b/sys/net/bpfjit.c Sat Feb 14 21:17:05 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bpfjit.c,v 1.41 2015/02/14 21:14:56 alnsn Exp $ */
+/* $NetBSD: bpfjit.c,v 1.42 2015/02/14 21:17:05 alnsn Exp $ */
/*-
* Copyright (c) 2011-2014 Alexander Nasonov.
@@ -31,9 +31,9 @@
#include <sys/cdefs.h>
#ifdef _KERNEL
-__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.41 2015/02/14 21:14:56 alnsn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpfjit.c,v 1.42 2015/02/14 21:17:05 alnsn Exp $");
#else
-__RCSID("$NetBSD: bpfjit.c,v 1.41 2015/02/14 21:14:56 alnsn Exp $");
+__RCSID("$NetBSD: bpfjit.c,v 1.42 2015/02/14 21:17:05 alnsn Exp $");
#endif
#include <sys/types.h>
@@ -1605,6 +1605,7 @@
bpf_alu_to_sljit_op(const struct bpf_insn *pc)
{
const int bad = SLJIT_UNUSED;
+ const uint32_t k = pc->k;
/*
* Note: all supported 64bit arches have 32bit multiply
@@ -1617,8 +1618,8 @@
case BPF_OR: return SLJIT_OR;
case BPF_XOR: return SLJIT_XOR;
case BPF_AND: return SLJIT_AND;
- case BPF_LSH: return (pc->k > 31) ? bad : SLJIT_SHL;
- case BPF_RSH: return (pc->k > 31) ? bad : SLJIT_LSHR|SLJIT_INT_OP;
+ case BPF_LSH: return (k > 31) ? bad : SLJIT_SHL;
+ case BPF_RSH: return (k > 31) ? bad : SLJIT_LSHR|SLJIT_INT_OP;
default:
return bad;
}
Home |
Main Index |
Thread Index |
Old Index