From: Ben Pfaff Date: Fri, 13 May 2011 23:50:20 +0000 (-0700) Subject: ofproto-dpif: Fix null pointer dereference in get_ofp_port(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7df6a8bdb4abe4ac41c6d1a9043b69cbaea23bcc;p=openvswitch ofproto-dpif: Fix null pointer dereference in get_ofp_port(). --- diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 93acd429..b7194930 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1353,7 +1353,8 @@ is_mirror_output_bundle(struct ofproto *ofproto_, void *aux) static struct ofport_dpif * get_ofp_port(struct ofproto_dpif *ofproto, uint16_t ofp_port) { - return ofport_dpif_cast(ofproto_get_port(&ofproto->up, ofp_port)); + struct ofport *ofport = ofproto_get_port(&ofproto->up, ofp_port); + return ofport ? ofport_dpif_cast(ofport) : NULL; } static struct ofport_dpif *