Hal Rosenstock pointed out this calloc() could fail.
Signed-off-by: Jim Schutt <[email protected]>
---
opensm/opensm/osm_torus.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/opensm/opensm/osm_torus.c b/opensm/opensm/osm_torus.c
index 12b480d..3b67f16 100644
--- a/opensm/opensm/osm_torus.c
+++ b/opensm/opensm/osm_torus.c
@@ -410,7 +410,11 @@ struct torus_context *torus_context_create(osm_opensm_t
*osm)
struct torus_context *ctx;
ctx = calloc(1, sizeof(*ctx));
- ctx->osm = osm;
+ if (ctx)
+ ctx->osm = osm;
+ else
+ OSM_LOG(&osm->log, OSM_LOG_ERROR,
+ "Error: calloc: %s\n", strerror(errno));
return ctx;
}
@@ -9113,6 +9117,8 @@ int osm_ucast_torus2QoS_setup(struct osm_routing_engine
*r,
struct torus_context *ctx;
ctx = torus_context_create(osm);
+ if (!ctx)
+ return -1;
r->context = ctx;
r->ucast_build_fwd_tables = torus_build_lfts;
--
1.6.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html