projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Avoid pointer arithmetic on void*.
[openvswitch]
/
switch
/
datapath.c
diff --git
a/switch/datapath.c
b/switch/datapath.c
index 607347d8626f5153c6baa752774e022acb4ab447..96193002f6f1625902ccd0c28d1e3bfe4c0cbed0 100644
(file)
--- a/
switch/datapath.c
+++ b/
switch/datapath.c
@@
-328,7
+328,7
@@
dp_run(struct datapath *dp)
const int hard_header = VLAN_ETH_HEADER_LEN;
const int mtu = netdev_get_mtu(p->netdev);
buffer = ofpbuf_new(headroom + hard_header + mtu);
const int hard_header = VLAN_ETH_HEADER_LEN;
const int mtu = netdev_get_mtu(p->netdev);
buffer = ofpbuf_new(headroom + hard_header + mtu);
- buffer->data
+=
headroom;
+ buffer->data
= (char*)buffer->data +
headroom;
}
error = netdev_recv(p->netdev, buffer);
if (!error) {
}
error = netdev_recv(p->netdev, buffer);
if (!error) {
@@
-1041,7
+1041,7
@@
modify_vlan(struct ofpbuf *buffer,
veh = ofpbuf_push_uninit(buffer, VLAN_HEADER_LEN);
memcpy(veh, &tmp, sizeof tmp);
veh = ofpbuf_push_uninit(buffer, VLAN_HEADER_LEN);
memcpy(veh, &tmp, sizeof tmp);
- buffer->l2
-=
VLAN_HEADER_LEN;
+ buffer->l2
= (char*)buffer->l2 -
VLAN_HEADER_LEN;
}
} else {
/* Remove an existing vlan header if it exists */
}
} else {
/* Remove an existing vlan header if it exists */
@@
-1054,8
+1054,8
@@
modify_vlan(struct ofpbuf *buffer,
tmp.eth_type = veh->veth_next_type;
buffer->size -= VLAN_HEADER_LEN;
tmp.eth_type = veh->veth_next_type;
buffer->size -= VLAN_HEADER_LEN;
- buffer->data
+=
VLAN_HEADER_LEN;
- buffer->l2
+=
VLAN_HEADER_LEN;
+ buffer->data
= (char*)buffer->data +
VLAN_HEADER_LEN;
+ buffer->l2
= (char*)buffer->l2 +
VLAN_HEADER_LEN;
memcpy(buffer->data, &tmp, sizeof tmp);
}
}
memcpy(buffer->data, &tmp, sizeof tmp);
}
}