opensm: Fixed pointer validity check in report_torus_changes()
PATCH 1/1 opensm: Fixed pointer validity check in report_torus_changes()
struct torus *nt should be checked for validity before getting assignments.
--- opensm/osm_torus.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)
opensm/osm_torus.c +7 -3
@@ -7423,13 +7423,17 @@ void report_torus_changes(struct torus *nt, struct torus *ot) {unsigned cnt =0 ;unsigned i, j, k; -unsigned x_sz = nt->x_sz; -unsigned y_sz = nt->y_sz; -unsigned z_sz = nt->z_sz; +unsigned x_sz; +unsigned y_sz; +unsigned z_sz;if (!(nt && ot))return ; + x_sz = nt->x_sz; + y_sz = nt->y_sz; + z_sz = nt->z_sz; +if (x_sz != ot->x_sz) { cnt++; OSM_LOG(&nt->osm->log, OSM_LOG_INFO,
Signature · 6 lines
1.7.3.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): 20110307095930.GH5577-iQai9MGU/dyyaiaB+Ve85laTQe2KTcn/@public.gmane.org
Hi Alex,
Quoted 12 lines · Alex Netes
struct torus *nt should be checked for validity before getting assignments.
--- opensm/osm_torus.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-)opensm/osm_torus.c +0
-0
opensm/osm_torus.c void report_torus_changes(struct torus *nt, struct torus *ot) · line 7428
Quoted 9 lines
opensm/osm_torus.c +3
-3@@ -7423,13 +7423,17 @@ void report_torus_changes(struct torus *nt, struct torus *ot) {unsigned cnt =0 ;unsigned i, j, k; -unsigned x_sz = nt->x_sz; -unsigned y_sz = nt->y_sz; -unsigned z_sz = nt->z_sz; +unsigned x_sz; +unsigned y_sz; +unsigned z_sz;
Actually, nt is guaranteed to be non-NULL; check the only caller (torus_build_lfts()).
opensm/osm_torus.c void report_torus_changes(struct torus *nt, struct torus *ot) · line 7431
Quoted 3 lines
opensm/osm_torus.c +0
-0if (!(nt && ot))return ;
This check for nt is redundant, I think. Only ot has any possibility of being NULL.
-- Jim
opensm/osm_torus.c void report_torus_changes(struct torus *nt, struct torus *ot) · line 7439
Quoted 8 lines
opensm/osm_torus.c +4
-0+ x_sz = nt->x_sz; + y_sz = nt->y_sz; + z_sz = nt->z_sz; +if (x_sz != ot->x_sz) { cnt++; OSM_LOG(&nt->osm->log, OSM_LOG_INFO,
--
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