X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fnetlink.c;h=cb4e6c1a15a750e3e9b9e254f7ff2aab5a7da2f5;hb=58b3bc45e4513ec01b52a74d7a02c6e8de799823;hp=e2aa7dbf6d737a2e857fb6fbb09a70a63055aca1;hpb=5549180a542fa7aa17a196d55b2f5eb4cbb3159a;p=sliver-openvswitch.git diff --git a/lib/netlink.c b/lib/netlink.c index e2aa7dbf6..cb4e6c1a1 100644 --- 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) { - 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; @@ -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); - 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)", - offset, nla->nla_type, aligned_len, tail - p); + offset, nla->nla_type, aligned_len, + (char*)tail - (char*)p); 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. */ } - 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);