From 3c336a95ae9c82fc19a78b99c66b3982c495b41b Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 3 Mar 2012 13:55:54 +0100 Subject: [PATCH] isl_basic_map_align_divs: fix potential invalid access isl_basic_map_align_divs is currently only called on inputs that are known not to be NULL, but since we check whether they are NULL anyway, we might as well only access them after this test. Signed-off-by: Sven Verdoolaege --- isl_map.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/isl_map.c b/isl_map.c index 5c693b06..4233b46e 100644 --- a/isl_map.c +++ b/isl_map.c @@ -7611,7 +7611,7 @@ struct isl_basic_map *isl_basic_map_align_divs( struct isl_basic_map *dst, struct isl_basic_map *src) { int i; - unsigned total = isl_space_dim(src->dim, isl_dim_all); + unsigned total; if (!dst || !src) goto error; @@ -7628,6 +7628,7 @@ struct isl_basic_map *isl_basic_map_align_divs( src->n_div, 0, 2 * src->n_div); if (!dst) return NULL; + total = isl_space_dim(src->dim, isl_dim_all); for (i = 0; i < src->n_div; ++i) { int j = find_div(dst, src, i); if (j < 0) { -- 2.11.4.GIT