Skip to contentSkip to conversation

opensm/st.c: fix potential core dumps

PATCH Applied Yevgeny Kliteynik 2 participants 2 messages Sep 7, 2010 – Nov 30, 2010 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 opensm/st.c: fix potential core dumps

If we're out of polynomials, new_size() will return -1 Deal with this in low-level calls.

---
 opensm/opensm/st.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
opensm/opensm/st.c +5 -0
index ea76038..469ba9d 100644
@@ -194,6 +194,8 @@ size_t size;
 #endif
 
 	size = new_size(size);	/* round up to prime number */
+	if (size < 0)
+		return NULL;
 
 	tbl = alloc(st_table);
 	tbl->type = type;
@@ -351,6 +353,9 @@ register st_table *table;
 	unsigned int hash_val;
 
 	new_num_bins = new_size(old_num_bins + 1);
+	if (new_num_bins < 0)
+		return;
+
 	new_bins =
 	    (st_table_entry **) Calloc(new_num_bins, sizeof(st_table_entry *));
 
Signature · 6 lines
1.6.2.4

--
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

A message that is not in the archive (sent off-list or not yet received): 4C8657D1.40900-VPRAkNaXOzVS1MOuV/[email protected]