From 39a1db1402bea36cb5727a5041440f10bf4660e9 Mon Sep 17 00:00:00 2001 From: ShyamsundarR Date: Mon, 15 Oct 2018 20:45:18 -0400 Subject: coverity: ignore tainted access reported in gf_free Coverity reports tainted pointer access in _gf_free if the pointer passed in was used by any IO related function by the caller. The taint within gf_free is a false positive, as the tainted region is from the passed in pointer till its allocated lenght, and not for contents before the pointer (i.e the GF_MEM_HEADER_SIZE bytes before the passed in pointer), as that is exclusively handled by the gf_alloc family of functions. CID: 1228602, 1292646, 1292647, 1292648, 1292649, 1383192, 1383195, 1389691 Should additionally fix, CID: 1292650, 1292651, 1357874, 1382373, 1382404, 1382407 Change-Id: I48c5a4028e7b0224c432bbc30f8c29408c2a466b Updates: bz#789278 Signed-off-by: ShyamsundarR --- libglusterfs/src/mem-pool.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libglusterfs') diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c index cff96323867..ad433d4af2d 100644 --- a/libglusterfs/src/mem-pool.c +++ b/libglusterfs/src/mem-pool.c @@ -300,6 +300,16 @@ __gf_mem_invalidate(void *ptr) } #endif /* DEBUG */ +/* Coverity taint NOTE: pointers passed to free, would operate on +pointer-GF_MEM_HEADER_SIZE content and if the pointer was used for any IO +related purpose, the pointer stands tainted, and hence coverity would consider +access to the said region as tainted. The following directive to coverity hence +sanitizes the pointer, thus removing any taint to the same within this function. +If the pointer is accessed outside the scope of this function without any +checks on content read from an IO operation, taints will still be reported, and +needs appropriate addressing. */ + +/* coverity[ +tainted_string_sanitize_content : arg-0 ] */ void __gf_free(void *free_ptr) { -- cgit