Introduce the check_malloc_usable_size flag (on by default).
When the flag is set to zero, we do not check for errors in malloc_usable_size.
This may be useful to work around a bug in Nvidia drivers prior to 295.*


git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@157472 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/asan/asan_allocator.cc b/lib/asan/asan_allocator.cc
index 2c31c85..05e2119 100644
--- a/lib/asan/asan_allocator.cc
+++ b/lib/asan/asan_allocator.cc
@@ -865,7 +865,7 @@
   CHECK(stack);
   if (ptr == NULL) return 0;
   size_t usable_size = malloc_info.AllocationSize((uintptr_t)ptr);
-  if (usable_size == 0) {
+  if (FLAG_check_malloc_usable_size && (usable_size == 0)) {
     Report("ERROR: AddressSanitizer attempting to call malloc_usable_size() "
            "for pointer which is not owned: %p\n", ptr);
     stack->PrintStack();