From: Ben Pfaff Date: Sun, 13 May 2012 23:41:05 +0000 (-0700) Subject: ovs-ofctl: Avoid impossible check for !osm in fetch_port_by_stats(). X-Git-Tag: sliver-openvswitch-1.8.90-0~48^2~441 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=f4dace9c281baa7cb133ba0bc2dd997386389eed;p=sliver-openvswitch.git ovs-ofctl: Avoid impossible check for !osm in fetch_port_by_stats(). At the time of the call to ofpbuf_at(), we know that the ofp_stats_msg is present because ofputil_decode_msg_type() reported that it was. Therefore, we can use ofpbuf_at_assert() and don't have to check for a null pointer. Found by clang. Signed-off-by: Ben Pfaff --- diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index c1fce83cf..92808d943 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -620,8 +620,8 @@ fetch_port_by_stats(const char *vconn_name, verbosity + 1)); } - osm = ofpbuf_at(reply, 0, sizeof *osm); - done = !osm || !(ntohs(osm->flags) & OFPSF_REPLY_MORE); + osm = ofpbuf_at_assert(reply, 0, sizeof *osm); + done = !(ntohs(osm->flags) & OFPSF_REPLY_MORE); if (found) { /* We've already found the port, but we need to drain