[Openmp-commits] [PATCH] D62224: Add checks before dereferencing pointers

Hansang Bae via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu May 30 11:12:23 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG7c75ac0c60d6: Add checks before pointer dereferencing (authored by hbae).

Changed prior to commit:
  https://reviews.llvm.org/D62224?vs=200601&id=202243#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62224/new/

https://reviews.llvm.org/D62224

Files:
  openmp/runtime/src/ompt-specific.cpp


Index: openmp/runtime/src/ompt-specific.cpp
===================================================================
--- openmp/runtime/src/ompt-specific.cpp
+++ openmp/runtime/src/ompt-specific.cpp
@@ -210,7 +210,8 @@
 void __ompt_thread_assign_wait_id(void *variable) {
   kmp_info_t *ti = ompt_get_thread();
 
-  ti->th.ompt_thread_info.wait_id = (ompt_wait_id_t)(uintptr_t)variable;
+  if (ti)
+    ti->th.ompt_thread_info.wait_id = (ompt_wait_id_t)(uintptr_t)variable;
 }
 
 int __ompt_get_state_internal(ompt_wait_id_t *omp_wait_id) {
@@ -432,6 +433,9 @@
     return 0; // support only a single block
 
   kmp_info_t *thr = ompt_get_thread();
+  if (!thr)
+    return 0;
+
   kmp_taskdata_t *taskdata = thr->th.th_current_task;
   kmp_task_t *task = KMP_TASKDATA_TO_TASK(taskdata);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62224.202243.patch
Type: text/x-patch
Size: 785 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20190530/94fcdbd2/attachment-0001.bin>


More information about the Openmp-commits mailing list