[ofa-general] [PATCH] libibumad: fix NULL pointer referencing

Sasha Khapyorsky sashak at voltaire.com
Thu Nov 15 00:51:20 PST 2007


best_port = NULL is valid parameter value for resolve_ca_name(), so
check this.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 libibumad/src/umad.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libibumad/src/umad.c b/libibumad/src/umad.c
index 1012695..5b7b83e 100644
--- a/libibumad/src/umad.c
+++ b/libibumad/src/umad.c
@@ -303,7 +303,7 @@ resolve_ca_name(char *ca_name, int *best_port)
 	for (caidx = 0; caidx < n; caidx++) {
 		TRACE("checking ca '%s'", names[caidx]);
 
-		port = *best_port;
+		port = best_port ? *best_port : 0;
 		if ((port_type = resolve_ca_port(names[caidx], &port)) < 0)
 			continue;
 
-- 
1.5.3.rc2.29.gc4640f




More information about the general mailing list