[ofa-general] [PATCH] Fix max parameter passed to umad_get_cas_names

Ira Weiny weiny2 at llnl.gov
Fri Nov 14 14:54:06 PST 2008


>From a9149f4e38081d206d0be0af2194f4e09f944f21 Mon Sep 17 00:00:00 2001
From: Ira Weiny <weiny2 at llnl.gov>
Date: Fri, 14 Nov 2008 11:36:01 -0800
Subject: [PATCH] Fix max parameter passed to umad_get_cas_names


Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
---
 infiniband-diags/src/ibstat.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/infiniband-diags/src/ibstat.c b/infiniband-diags/src/ibstat.c
index 6be1302..e2775ca 100644
--- a/infiniband-diags/src/ibstat.c
+++ b/infiniband-diags/src/ibstat.c
@@ -65,6 +65,8 @@
 
 static int debug;
 
+#define MAX_DEVICES 20
+
 char *argv0 = "ibstat";
 
 static char *node_type_str[] = {
@@ -201,7 +203,7 @@ usage(void)
 int
 main(int argc, char *argv[])
 {
-	char names[20][UMAD_CA_NAME_LEN];
+	char names[MAX_DEVICES][UMAD_CA_NAME_LEN];
 	int dev_port = -1;
 	int list_only = 0, short_format = 0, list_ports = 0;
 	int n, i;
@@ -254,7 +256,7 @@ main(int argc, char *argv[])
 	if (umad_init() < 0)
 		IBPANIC("can't init UMAD library");
 
-	if ((n = umad_get_cas_names((void *)names, UMAD_CA_NAME_LEN)) < 0)
+	if ((n = umad_get_cas_names((void *)names, MAX_DEVICES)) < 0)
 		IBPANIC("can't list IB device names");
 
 	if (argc) {
-- 
1.5.4.5




More information about the general mailing list