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]
/
lib
/
netlink.c
diff --git
a/lib/netlink.c
b/lib/netlink.c
index e2aa7dbf6d737a2e857fb6fbb09a70a63055aca1..cb4e6c1a15a750e3e9b9e254f7ff2aab5a7da2f5 100644
(file)
--- a/
lib/netlink.c
+++ b/
lib/netlink.c
@@
-790,7
+790,7
@@
nl_policy_parse(const struct ofpbuf *msg, const struct nl_policy policy[],
tail = ofpbuf_tail(msg);
while (p < tail) {
tail = ofpbuf_tail(msg);
while (p < tail) {
- size_t offset =
p -
msg->data;
+ size_t offset =
(char*)p - (char*)
msg->data;
struct nlattr *nla = p;
size_t len, aligned_len;
uint16_t type;
struct nlattr *nla = p;
size_t len, aligned_len;
uint16_t type;
@@
-803,10
+803,11
@@
nl_policy_parse(const struct ofpbuf *msg, const struct nl_policy policy[],
}
len = nla->nla_len - NLA_HDRLEN;
aligned_len = NLA_ALIGN(len);
}
len = nla->nla_len - NLA_HDRLEN;
aligned_len = NLA_ALIGN(len);
- if (aligned_len >
tail -
p) {
+ if (aligned_len >
(char*)tail - (char*)
p) {
VLOG_DBG_RL(&rl, "%zu: attr %"PRIu16" aligned data len (%zu) "
"> bytes left (%tu)",
VLOG_DBG_RL(&rl, "%zu: attr %"PRIu16" aligned data len (%zu) "
"> bytes left (%tu)",
- offset, nla->nla_type, aligned_len, tail - p);
+ offset, nla->nla_type, aligned_len,
+ (char*)tail - (char*)p);
return false;
}
return false;
}
@@
-844,7
+845,7
@@
nl_policy_parse(const struct ofpbuf *msg, const struct nl_policy policy[],
} else {
/* Skip attribute type that we don't care about. */
}
} else {
/* Skip attribute type that we don't care about. */
}
- p
+=
NLA_ALIGN(nla->nla_len);
+ p
= (char*)p +
NLA_ALIGN(nla->nla_len);
}
if (n_required) {
VLOG_DBG_RL(&rl, "%zu required attrs missing", n_required);
}
if (n_required) {
VLOG_DBG_RL(&rl, "%zu required attrs missing", n_required);