From: Ben Pfaff Date: Wed, 8 May 2013 20:18:12 +0000 (-0700) Subject: ofproto-dpif: Make ofport_dpif_cast() internally consistent. X-Git-Tag: sliver-openvswitch-1.10.90-3~16^2~11 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=e3d8644df32fc4664970ec5e02cffe9fe742f681;p=sliver-openvswitch.git ofproto-dpif: Make ofport_dpif_cast() internally consistent. This function's assertion would dereference a null pointer given a null 'ofport' argument, but its return statement checked for a null pointer argument. This commit fixes the inconsistency in favor of supporting null pointer arguments. (I discovered this problem while writing a piece of code that wanted support for a null pointer argument, otherwise I would resolve the inconsistency in the other direction.) Signed-off-by: Ben Pfaff --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 49bf1e4d5..0d17dbf42 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -590,7 +590,6 @@ static uint16_t odp_port_to_ofp_port(const struct ofproto_dpif *, static struct ofport_dpif * ofport_dpif_cast(const struct ofport *ofport) { - ovs_assert(ofport->ofproto->ofproto_class == &ofproto_dpif_class); return ofport ? CONTAINER_OF(ofport, struct ofport_dpif, up) : NULL; }