From 00c234675f31a4942756080878742aa61f1be9f0 Mon Sep 17 00:00:00 2001 From: John Lindgren Date: Sun, 31 May 2015 11:48:30 -0400 Subject: [PATCH] Avoid indiscriminate use of VALGRIND_MAKE_MEM_NOACCESS. Marking stack-allocated objects as no-access creates false positives, which distract from finding real memory errors. https://bugs.freedesktop.org/show_bug.cgi?id=52548 --- src/cairo-freelist-private.h | 2 +- src/cairo-freelist.c | 8 ++++---- src/cairo-gstate.c | 2 +- src/cairo-path-fixed.c | 2 +- src/cairo-pattern.c | 10 +++++----- src/cairo-pen.c | 2 +- src/cairo-polygon.c | 2 +- src/cairo-region.c | 2 +- src/cairo-stroke-style.c | 2 +- src/cairo-traps.c | 2 +- src/cairo-tristrip.c | 2 +- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/cairo-freelist-private.h b/src/cairo-freelist-private.h index 8fe6516..f85f689 100644 --- a/src/cairo-freelist-private.h +++ b/src/cairo-freelist-private.h @@ -133,7 +133,7 @@ _cairo_freepool_free (cairo_freepool_t *freepool, void *ptr) node->next = freepool->first_free_node; freepool->first_free_node = node; - VG (VALGRIND_MAKE_MEM_NOACCESS (node, freepool->nodesize)); + VG (VALGRIND_MAKE_MEM_UNDEFINED (node, freepool->nodesize)); } #endif /* CAIRO_FREELIST_H */ diff --git a/src/cairo-freelist.c b/src/cairo-freelist.c index d596eab..631fe48 100644 --- a/src/cairo-freelist.c +++ b/src/cairo-freelist.c @@ -80,7 +80,7 @@ _cairo_freelist_free (cairo_freelist_t *freelist, void *voidnode) if (node) { node->next = freelist->first_free_node; freelist->first_free_node = node; - VG (VALGRIND_MAKE_MEM_NOACCESS (node, freelist->nodesize)); + VG (VALGRIND_MAKE_MEM_UNDEFINED (node, freelist->nodesize)); } } @@ -97,7 +97,7 @@ _cairo_freepool_init (cairo_freepool_t *freepool, unsigned nodesize) freepool->embedded_pool.rem = sizeof (freepool->embedded_data); freepool->embedded_pool.data = freepool->embedded_data; - VG (VALGRIND_MAKE_MEM_NOACCESS (freepool->embedded_data, sizeof (freepool->embedded_data))); + VG (VALGRIND_MAKE_MEM_UNDEFINED (freepool->embedded_data, sizeof (freepool->embedded_data))); } void @@ -119,7 +119,7 @@ _cairo_freepool_fini (cairo_freepool_t *freepool) pool = next; } - VG (VALGRIND_MAKE_MEM_NOACCESS (freepool, sizeof (freepool))); + VG (VALGRIND_MAKE_MEM_UNDEFINED (freepool, sizeof (freepool))); } void * @@ -152,7 +152,7 @@ _cairo_freepool_alloc_from_new_pool (cairo_freepool_t *freepool) pool->rem = poolsize - freepool->nodesize; pool->data = (uint8_t *) (pool + 1) + freepool->nodesize; - VG (VALGRIND_MAKE_MEM_NOACCESS (pool->data, pool->rem)); + VG (VALGRIND_MAKE_MEM_UNDEFINED (pool->data, pool->rem)); return pool + 1; } diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index b4e988e..4bf945c 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -225,7 +225,7 @@ _cairo_gstate_fini (cairo_gstate_t *gstate) cairo_pattern_destroy (gstate->source); gstate->source = NULL; - VG (VALGRIND_MAKE_MEM_NOACCESS (gstate, sizeof (cairo_gstate_t))); + VG (VALGRIND_MAKE_MEM_UNDEFINED (gstate, sizeof (cairo_gstate_t))); } /** diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c index 4bbf496..ac44bb7 100644 --- a/src/cairo-path-fixed.c +++ b/src/cairo-path-fixed.c @@ -347,7 +347,7 @@ _cairo_path_fixed_fini (cairo_path_fixed_t *path) _cairo_path_buf_destroy (this); } - VG (VALGRIND_MAKE_MEM_NOACCESS (path, sizeof (cairo_path_fixed_t))); + VG (VALGRIND_MAKE_MEM_UNDEFINED (path, sizeof (cairo_path_fixed_t))); } void diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index ac5d7af..b4bc83c 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -464,19 +464,19 @@ _cairo_pattern_fini (cairo_pattern_t *pattern) #if HAVE_VALGRIND switch (pattern->type) { case CAIRO_PATTERN_TYPE_SOLID: - VALGRIND_MAKE_MEM_NOACCESS (pattern, sizeof (cairo_solid_pattern_t)); + VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_solid_pattern_t)); break; case CAIRO_PATTERN_TYPE_SURFACE: - VALGRIND_MAKE_MEM_NOACCESS (pattern, sizeof (cairo_surface_pattern_t)); + VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_surface_pattern_t)); break; case CAIRO_PATTERN_TYPE_LINEAR: - VALGRIND_MAKE_MEM_NOACCESS (pattern, sizeof (cairo_linear_pattern_t)); + VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_linear_pattern_t)); break; case CAIRO_PATTERN_TYPE_RADIAL: - VALGRIND_MAKE_MEM_NOACCESS (pattern, sizeof (cairo_radial_pattern_t)); + VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_radial_pattern_t)); break; case CAIRO_PATTERN_TYPE_MESH: - VALGRIND_MAKE_MEM_NOACCESS (pattern, sizeof (cairo_mesh_pattern_t)); + VALGRIND_MAKE_MEM_UNDEFINED (pattern, sizeof (cairo_mesh_pattern_t)); break; case CAIRO_PATTERN_TYPE_RASTER_SOURCE: break; diff --git a/src/cairo-pen.c b/src/cairo-pen.c index 61be0e8..9bf9604 100644 --- a/src/cairo-pen.c +++ b/src/cairo-pen.c @@ -106,7 +106,7 @@ _cairo_pen_fini (cairo_pen_t *pen) free (pen->vertices); - VG (VALGRIND_MAKE_MEM_NOACCESS (pen, sizeof (cairo_pen_t))); + VG (VALGRIND_MAKE_MEM_UNDEFINED (pen, sizeof (cairo_pen_t))); } cairo_status_t diff --git a/src/cairo-polygon.c b/src/cairo-polygon.c index b0424f6..0e0b813 100644 --- a/src/cairo-polygon.c +++ b/src/cairo-polygon.c @@ -248,7 +248,7 @@ _cairo_polygon_fini (cairo_polygon_t *polygon) if (polygon->edges != polygon->edges_embedded) free (polygon->edges); - VG (VALGRIND_MAKE_MEM_NOACCESS (polygon, sizeof (cairo_polygon_t))); + VG (VALGRIND_MAKE_MEM_UNDEFINED (polygon, sizeof (cairo_polygon_t))); } /* make room for at least one more edge */ diff --git a/src/cairo-region.c b/src/cairo-region.c index ccfb220..6a51225 100644 --- a/src/cairo-region.c +++ b/src/cairo-region.c @@ -175,7 +175,7 @@ _cairo_region_fini (cairo_region_t *region) { assert (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (®ion->ref_count)); pixman_region32_fini (®ion->rgn); - VG (VALGRIND_MAKE_MEM_NOACCESS (region, sizeof (cairo_region_t))); + VG (VALGRIND_MAKE_MEM_UNDEFINED (region, sizeof (cairo_region_t))); } /** diff --git a/src/cairo-stroke-style.c b/src/cairo-stroke-style.c index 51c9414..9c373c3 100644 --- a/src/cairo-stroke-style.c +++ b/src/cairo-stroke-style.c @@ -91,7 +91,7 @@ _cairo_stroke_style_fini (cairo_stroke_style_t *style) style->num_dashes = 0; - VG (VALGRIND_MAKE_MEM_NOACCESS (style, sizeof (cairo_stroke_style_t))); + VG (VALGRIND_MAKE_MEM_UNDEFINED (style, sizeof (cairo_stroke_style_t))); } /* diff --git a/src/cairo-traps.c b/src/cairo-traps.c index 3aa0052..1b74848 100644 --- a/src/cairo-traps.c +++ b/src/cairo-traps.c @@ -113,7 +113,7 @@ _cairo_traps_fini (cairo_traps_t *traps) if (traps->traps != traps->traps_embedded) free (traps->traps); - VG (VALGRIND_MAKE_MEM_NOACCESS (traps, sizeof (cairo_traps_t))); + VG (VALGRIND_MAKE_MEM_UNDEFINED (traps, sizeof (cairo_traps_t))); } /* make room for at least one more trap */ diff --git a/src/cairo-tristrip.c b/src/cairo-tristrip.c index bb4972f..bcf3b23 100644 --- a/src/cairo-tristrip.c +++ b/src/cairo-tristrip.c @@ -58,7 +58,7 @@ _cairo_tristrip_fini (cairo_tristrip_t *strip) if (strip->points != strip->points_embedded) free (strip->points); - VG (VALGRIND_MAKE_MEM_NOACCESS (strip, sizeof (cairo_tristrip_t))); + VG (VALGRIND_MAKE_MEM_UNDEFINED (strip, sizeof (cairo_tristrip_t))); } -- 2.4.2