From: Ben Pfaff Date: Thu, 24 Jan 2013 19:51:54 +0000 (-0800) Subject: ofproto: Avoid wild write removing OFPP_LOCAL port in dealloc_ofp_port(). X-Git-Tag: sliver-openvswitch-1.9.90-3~3^2~36 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=40fa9417d0bf4a49f63cc28a2591e6098bd4cf00 ofproto: Avoid wild write removing OFPP_LOCAL port in dealloc_ofp_port(). Found by valgrind. Signed-off-by: Ben Pfaff Acked-by: Ethan Jackson --- diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 9bae97192..b6cd0829c 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1644,7 +1644,9 @@ alloc_ofp_port(struct ofproto *ofproto, const char *netdev_name) static void dealloc_ofp_port(const struct ofproto *ofproto, uint16_t ofp_port) { - bitmap_set0(ofproto->ofp_port_ids, ofp_port); + if (ofp_port < ofproto->max_ports) { + bitmap_set0(ofproto->ofp_port_ids, ofp_port); + } } /* Opens and returns a netdev for 'ofproto_port' in 'ofproto', or a null