Title: [234913] trunk/Source/bmalloc
Revision
234913
Author
tpop...@redhat.com
Date
2018-08-16 00:41:46 -0700 (Thu, 16 Aug 2018)

Log Message

bmalloc: Coverity scan issues
https://bugs.webkit.org/show_bug.cgi?id=186763

Reviewed by Saam Barati.

* bmalloc/DebugHeap.h: Initialize the m_pageSize variable.
* bmalloc/IsoTLS.cpp:
(bmalloc::IsoTLS::ensureEntries): Check the return value of
pthread_key_create return().
* bmalloc/VMAllocate.h:
(bmalloc::vmPageSize): Correctly check the return value of sysconf().

Modified Paths

Diff

Modified: trunk/Source/bmalloc/ChangeLog (234912 => 234913)


--- trunk/Source/bmalloc/ChangeLog	2018-08-16 05:38:39 UTC (rev 234912)
+++ trunk/Source/bmalloc/ChangeLog	2018-08-16 07:41:46 UTC (rev 234913)
@@ -1,3 +1,17 @@
+2018-08-16  Tomas Popela  <tpop...@redhat.com>
+
+        bmalloc: Coverity scan issues
+        https://bugs.webkit.org/show_bug.cgi?id=186763
+
+        Reviewed by Saam Barati.
+
+        * bmalloc/DebugHeap.h: Initialize the m_pageSize variable.
+        * bmalloc/IsoTLS.cpp:
+        (bmalloc::IsoTLS::ensureEntries): Check the return value of
+        pthread_key_create return().
+        * bmalloc/VMAllocate.h:
+        (bmalloc::vmPageSize): Correctly check the return value of sysconf().
+
 2018-07-27  Mark Lam  <mark....@apple.com>
 
         Initialize bmalloc::DebugHeap::m_pageSize for non-Darwin builds.

Modified: trunk/Source/bmalloc/bmalloc/DebugHeap.h (234912 => 234913)


--- trunk/Source/bmalloc/bmalloc/DebugHeap.h	2018-08-16 05:38:39 UTC (rev 234912)
+++ trunk/Source/bmalloc/bmalloc/DebugHeap.h	2018-08-16 07:41:46 UTC (rev 234913)
@@ -53,7 +53,7 @@
 #endif
     
     // This is the debug heap. We can use whatever data structures we like. It doesn't matter.
-    size_t m_pageSize;
+    size_t m_pageSize { 0 };
     std::mutex m_lock;
     std::unordered_map<void*, size_t> m_sizeMap;
 };

Modified: trunk/Source/bmalloc/bmalloc/IsoTLS.cpp (234912 => 234913)


--- trunk/Source/bmalloc/bmalloc/IsoTLS.cpp	2018-08-16 05:38:39 UTC (rev 234912)
+++ trunk/Source/bmalloc/bmalloc/IsoTLS.cpp	2018-08-16 07:41:46 UTC (rev 234913)
@@ -69,7 +69,9 @@
 #if HAVE_PTHREAD_MACHDEP_H
             pthread_key_init_np(tlsKey, destructor);
 #else
-            pthread_key_create(&s_tlsKey, destructor);
+            int error = pthread_key_create(&s_tlsKey, destructor);
+            if (error)
+                BCRASH();
             s_didInitialize = true;
 #endif
         });

Modified: trunk/Source/bmalloc/bmalloc/VMAllocate.h (234912 => 234913)


--- trunk/Source/bmalloc/bmalloc/VMAllocate.h	2018-08-16 05:38:39 UTC (rev 234912)
+++ trunk/Source/bmalloc/bmalloc/VMAllocate.h	2018-08-16 07:41:46 UTC (rev 234913)
@@ -56,8 +56,12 @@
 inline size_t vmPageSize()
 {
     static size_t cached;
-    if (!cached)
-        cached = sysconf(_SC_PAGESIZE);
+    if (!cached) {
+        long pageSize = sysconf(_SC_PAGESIZE);
+        if (pageSize < 0)
+            BCRASH();
+        cached = pageSize;
+    }
     return cached;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to