[ovs-dev] [PATCH 1/5] ofproto: Avoid wild write removing OFPP_LOCAL port in dealloc_ofp_port().

Ethan Jackson ethan at nicira.com
Thu Jan 24 19:49:46 UTC 2013


Acked-by: Ethan Jackson <ethan at nicira.com>

On Thu, Jan 24, 2013 at 11:47 AM, Ben Pfaff <blp at nicira.com> wrote:
> Found by valgrind.
>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
>  ofproto/ofproto.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
> index 9bae971..b6cd082 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
> --
> 1.7.2.5
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list