[ofa-general] [PATCH] opensm/osm_lin_fwd_tbl.c: Eliminate potential NULL pointer dereference

Hal Rosenstock hrosenstock at xsigo.com
Mon Jun 2 10:05:17 PDT 2008


opensm/osm_lin_fwd_tbl.c: Eliminate potential NULL pointer dereference

Signed-off-by: Hal Rosenstock <hal at xsigo.com>

diff --git a/opensm/opensm/osm_lin_fwd_tbl.c b/opensm/opensm/osm_lin_fwd_tbl.c
index dc62f84..d311650 100644
--- a/opensm/opensm/osm_lin_fwd_tbl.c
+++ b/opensm/opensm/osm_lin_fwd_tbl.c
@@ -77,8 +77,8 @@ osm_lin_fwd_tbl_t *osm_lin_tbl_new(IN uint16_t const size)
 	/*
 	   Initialize the table to OSM_NO_PATH, which means "invalid port"
 	 */
-	memset(p_tbl, OSM_NO_PATH, __osm_lin_tbl_compute_obj_size(size));
 	if (p_tbl != NULL) {
+		memset(p_tbl, OSM_NO_PATH, __osm_lin_tbl_compute_obj_size(size)); 
 		p_tbl->size = (uint16_t) size;
 	}
 	return (p_tbl);





More information about the general mailing list