X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fnetlink.c;h=cb4e6c1a15a750e3e9b9e254f7ff2aab5a7da2f5;hb=eda13285783d788d08e4911f44730829aaadd433;hp=e2aa7dbf6d737a2e857fb6fbb09a70a63055aca1;hpb=ad8d3e6bdf9c2f962d698e6836ae9bc69bd464cc;p=openvswitch diff --git a/lib/netlink.c b/lib/netlink.c index e2aa7dbf..cb4e6c1a 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);