summaryrefslogtreecommitdiff
path: root/device
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2013-06-29 20:35:13 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2013-06-29 20:35:13 +0200
commit1dc6074b62f8141e9848bbaee7275e5752507e8f (patch)
treebb42fcffbfb20ef043fb9b4c85ea46afb99b0e21 /device
parentf925d0efa2161aef215f858347a9036f1153c4b2 (diff)
Fix int/long discrepancy
* device/net_io.c (bpf_match): Make the `keys' parameter a pointer to unsigned int instead of unsigned long. (bpf_do_filter): Make `A', `B' and `mem' unsigned ints instead of unsigned longs. Also turn long casts into int casts.
Diffstat (limited to 'device')
-rw-r--r--device/net_io.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/device/net_io.c b/device/net_io.c
index 4ebf996..fd71c02 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -394,7 +394,7 @@ int net_add_q_info (ipc_port_t rcv_port);
int bpf_match (
net_hash_header_t hash,
int n_keys,
- unsigned long *keys,
+ unsigned int *keys,
net_hash_entry_t **hash_headpp,
net_hash_entry_t *entpp);
@@ -1636,9 +1636,9 @@ bpf_do_filter(infp, p, wirelen, header, hlen, hash_headpp, entpp)
register bpf_insn_t pc, pc_end;
register unsigned int buflen;
- register unsigned long A, X;
+ register unsigned int A, X;
register int k;
- unsigned long mem[BPF_MEMWORDS];
+ unsigned int mem[BPF_MEMWORDS];
/* Generic pointer to either HEADER or P according to the specified offset. */
char *data = NULL;
@@ -1689,9 +1689,9 @@ bpf_do_filter(infp, p, wirelen, header, hlen, hash_headpp, entpp)
k = pc->k;
load_word:
- if ((u_int)k + sizeof(long) <= hlen)
+ if ((u_int)k + sizeof(int) <= hlen)
data = header;
- else if ((u_int)k + sizeof(long) <= buflen) {
+ else if ((u_int)k + sizeof(int) <= buflen) {
k -= hlen;
data = p;
} else
@@ -1702,7 +1702,7 @@ bpf_do_filter(infp, p, wirelen, header, hlen, hash_headpp, entpp)
A = EXTRACT_LONG(&data[k]);
else
#endif
- A = ntohl(*(long *)(data + k));
+ A = ntohl(*(int *)(data + k));
continue;
case BPF_LD|BPF_H|BPF_ABS:
@@ -2032,7 +2032,7 @@ int
bpf_match (hash, n_keys, keys, hash_headpp, entpp)
net_hash_header_t hash;
register int n_keys;
- register unsigned long *keys;
+ register unsigned int *keys;
net_hash_entry_t **hash_headpp, *entpp;
{
register net_hash_entry_t head, entp;