[ofa-general] [PATCH] opensm/osm_ucast_ftree.c Increase the size of the hop table
Line.Holen at Sun.COM
Line.Holen at Sun.COM
Tue May 5 06:25:19 PDT 2009
The hops table of ftree_sw_t is too small to hold the hop count
of max_lid. Changed sw_create() to allocate hops[max_lid+1]
not hops[max_lid].
Signed-off-by: Line Holen <Line.Holen at sun.com>
---
diff --git a/opensm/opensm/osm_ucast_ftree.c b/opensm/opensm/osm_ucast_ftree.c
index 0c4741a..8ed2f74 100644
--- a/opensm/opensm/osm_ucast_ftree.c
+++ b/opensm/opensm/osm_ucast_ftree.c
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
* Copyright (c) 2002-2007 Mellanox Technologies LTD. All rights reserved.
* Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
@@ -554,10 +555,10 @@ static ftree_sw_t *sw_create(IN ftree_fabric_t * p_ftree,
/* initialize lft buffer */
memset(p_osm_sw->new_lft, OSM_NO_PATH, IB_LID_UCAST_END_HO + 1);
- p_sw->hops = malloc(p_osm_sw->max_lid_ho * sizeof(*(p_sw->hops)));
+ p_sw->hops = malloc((p_osm_sw->max_lid_ho + 1) * sizeof(*(p_sw->hops)));
if(p_sw->hops == NULL)
return NULL;
- memset(p_sw->hops, OSM_NO_PATH, p_osm_sw->max_lid_ho);
+ memset(p_sw->hops, OSM_NO_PATH, p_osm_sw->max_lid_ho + 1);
return p_sw;
} /* sw_create() */
More information about the general
mailing list